Hi VM guys. Does anybody have any insights into the following?: I get the following crash. I've tried this on a Windows VM of unknown version and a 3.9-alpha Linux VM with the same result: Segmentation fault This happens on start-up. None of the VM flags I tried make a difference. I suspect this may have caused it: !EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009 21:54' prior: 36505616! This code worked fine until I saved, quit and tried to reopen the image. Note that this class is actually defined in my namespaces implementation - it does not exist in the SystemDictionary and has it's environment set to an instance of Namespace. It is my own implementation of EventSensor and I've added the primitive methods to it. I'm not sure if any of this matters. I'm going to put this image aside rather than try to fix the above and make a new image so I can continue my work. This problem will continue to exist, however, so if I have any breakthroughs as to what is happening, I'll post a reply. Gulik. --http://gulik.pbwiki.com/ |
when you run it on linux under gdb what's teh stack trace for the seg fault? On Wed, Mar 18, 2009 at 12:49 AM, Michael van der Gulik <[hidden email]> wrote:
|
I'll build a VM with debugging symbols this weekend if I can remember where I stashed my VM source. I've rebuilt a working image, so hopefully I should be able to recreate the problem easily. Gulik. On Thu, Mar 19, 2009 at 4:27 AM, Eliot Miranda <[hidden email]> wrote:
-- http://gulik.pbwiki.com/ |
<snip> >>> Hi VM guys. >>> >>> Does anybody have any insights into the following?: >>> >>> I get the following crash. I've tried this on a Windows VM of unknown >>> version and a 3.9-alpha Linux VM with the same result: >>> >>> Segmentation fault >>> I suspect this may have caused it: >>> >>> !EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009 >>> 21:54' prior: 36505616! >>> startUp >>> [ >>> panicButtonPressed := false. >>> >>> Smalltalk.Sensor shutDown. >>> inputSemaphore := Semaphore new. >>> Smalltalk.ExternalSemaphoreTable registerExternalObject: >>> inputSemaphore. >>> self primSetInputSemaphore: inputSemaphore. >>> >>> self enterEventLoop. >>> ] ensure: [ >>> Smalltalk.Sensor startUp. >>> Smalltalk.Display restore. >>> ].! ! >>> gdb says: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1210165584 (LWP 21449)] 0x0807db94 in transferTo (aProc=599900164) at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22468 22468 tmp = longAt(((longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) + BaseHeaderSize) + (MethodIndex << ShiftForWord)); (gdb) bt #0 0x0807db94 in transferTo (aProc=599900164) at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22468 #1 0x0807be70 in resume (aProcess=599900164) at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:21277 #2 0x0807da45 in synchronousSignal (aSemaphore=600188584) at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22424 #3 0x08077859 in primitiveSignal () at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:18722 #4 0x08060ac6 in dispatchFunctionPointer (aFunctionPointer=0x80777a1) at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:3949 #5 0x080667cf in interpret () at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:7756 #6 0x0805d652 in main () (gdb) l 22463 if ((longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) < foo->youngStart) { 22464 beRootIfOld(longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))); 22465 } 22466 foo->activeContext = longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord)); 22467 /* begin fetchContextRegisters: */ 22468 tmp = longAt(((longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) + BaseHeaderSize) + (MethodIndex << ShiftForWord)); 22469 if ((tmp & 1)) { 22470 tmp = longAt(((longAt((newProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) + BaseHeaderSize) + (HomeIndex << ShiftForWord)); 22471 if (tmp < foo->youngStart) { 22472 beRootIfOld(tmp); (gdb) p newProc $1 = 599900164 By my understanding, Interpreter>>fetchContextRegisters: is reading from a corrupted method context when it changes processes (in Semaphore>>critical:) . My next step would be to manually dissect that context using gdb. I suspect this is related to start-up code somehow which is changing processes before something is initialised (??). I can recreate this problem very easily. If anybody is interested in debugging this more, I can send you an image. Otherwise I'll report this on bugs.squeak.org assigned to myself and hack at it again when it annoys me enough. Gulik. -- http://gulik.pbwiki.com/ |
On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote: <snip> <bigger snip> I've isolated the bug. To reproduce, do the following in a disposable image: Sensor primSetInputSemaphore: (Semaphore new). Save the image. Try to open it. It will crash. http://bugs.squeak.org/view.php?id=7320 Gulik. -- |
2009/3/22 Michael van der Gulik <[hidden email]>: > > > > On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote: >> >> <snip> >> >>> Hi VM guys. >> >>> >> >>> Does anybody have any insights into the following?: > > <bigger snip> > > I've isolated the bug. To reproduce, do the following in a disposable image: > > Sensor primSetInputSemaphore: (Semaphore new). > self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore). > Save the image. Try to open it. It will crash. > > http://bugs.squeak.org/view.php?id=7320 > > Gulik. > > -- > > http://gulik.pbwiki.com/ > > -- Best regards, Igor Stasenko AKA sig. |
2009/3/22 Igor Stasenko <[hidden email]>: > 2009/3/22 Michael van der Gulik <[hidden email]>: >> >> >> >> On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote: >>> >>> <snip> >>> >>> Hi VM guys. >>> >>> >>> >>> Does anybody have any insights into the following?: >> >> <bigger snip> >> >> I've isolated the bug. To reproduce, do the following in a disposable image: >> >> Sensor primSetInputSemaphore: (Semaphore new). >> > > self > primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore). > object intead of valid smallinteger index in external objects table. It should check and fail if you do so. >> Save the image. Try to open it. It will crash. >> >> http://bugs.squeak.org/view.php?id=7320 >> >> Gulik. >> >> -- >> >> http://gulik.pbwiki.com/ >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > -- Best regards, Igor Stasenko AKA sig. |
On Sun, Mar 22, 2009 at 11:40 PM, Igor Stasenko <[hidden email]> wrote:
Thanks, Igor. I never was good at details. When I next have time (Tuesday evening?) I'll submit a patch for this: - rename primSetInputSemaphore: to primSetInputSemaphoreIndex:. - Add checks in the VM: must be a SmallInteger, must be a valid index in the external objects table, must point to a Semaphore. - Add error handling code in the method itself. Gulik. -- http://gulik.pbwiki.com/ |
On 3/23/09, Michael van der Gulik <[hidden email]> wrote: > When I next have time (Tuesday evening?) I'll submit a patch for this: > > - rename primSetInputSemaphore: to primSetInputSemaphoreIndex:. > - Add checks in the VM: must be a SmallInteger, must be a valid index in > the > external objects table, must point to a Semaphore. > - Add error handling code in the method itself. I tried with some success, but now my compiled VM just starts up with a black box in the top left, the rest of the screen is white and about 80% CPU is consumed. This is on Linux after accidently closing the VMMaker window and reopening it. Is this a common occurance that is easy to fix? My attempt at fixing the input semaphore problem is attached to http://bugs.squeak.org/view.php?id=7320, if anybody has interest. I can't test it because of the above problem. The original Interpreter>>primitiveInputSemaphore has problems. It does not pop off the stack if the C code fails. "TheInputSemaphore" is nil, and gets translated to "null" in interp.c. Gulik. -- http://gulik.pbwiki.com/ |
2009/3/23 Michael van der Gulik <[hidden email]>: > > On 3/23/09, Michael van der Gulik <[hidden email]> wrote: > >> When I next have time (Tuesday evening?) I'll submit a patch for this: >> >> - rename primSetInputSemaphore: to primSetInputSemaphoreIndex:. >> - Add checks in the VM: must be a SmallInteger, must be a valid index in >> the >> external objects table, must point to a Semaphore. >> - Add error handling code in the method itself. > > I tried with some success, but now my compiled VM just starts up with > a black box in the top left, the rest of the screen is white and about > 80% CPU is consumed. This is on Linux after accidently closing the > VMMaker window and reopening it. > > Is this a common occurance that is easy to fix? this is beyond my experience. I tried to build VM on linux only once, and don't remember any serious problems with it. > > My attempt at fixing the input semaphore problem is attached to > http://bugs.squeak.org/view.php?id=7320, if anybody has interest. I > can't test it because of the above problem. > > The original Interpreter>>primitiveInputSemaphore has problems. It > does not pop off the stack if the C code fails. "TheInputSemaphore" is > nil, and gets translated to "null" in interp.c. > when primitive fails, it should keep the original stack state unchanged, because it then used to enter a method, where primitive located. > Gulik. > > -- > http://gulik.pbwiki.com/ > -- Best regards, Igor Stasenko AKA sig. |
Free forum by Nabble | Edit this page |