I am looking for a class that displays the call tree of an executed
block of code. thanks, Rob |
> I am looking for a class that displays the call tree of an executed
> block of code. MessageTally spyOn: [ 1000 factorial ] Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch |
Yes, that looks familiar now that I see it.
thanks, Rob On Oct 2, 2007, at 6:19 PM, Lukas Renggli wrote: >> I am looking for a class that displays the call tree of an executed >> block of code. > > MessageTally spyOn: [ 1000 factorial ] > > Cheers, > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > |
I typically find myself using TimeProfileBrowser more often.
TimeProfileBrowser onBlock: [ 1000 factorial ] Travis Robert Withers wrote: > Yes, that looks familiar now that I see it. > > thanks, > Rob > > On Oct 2, 2007, at 6:19 PM, Lukas Renggli wrote: > >>> I am looking for a class that displays the call tree of an executed >>> block of code. >> >> MessageTally spyOn: [ 1000 factorial ] >> >> Cheers, >> Lukas >> >> -- >> Lukas Renggli >> http://www.lukas-renggli.ch >> > > |
In reply to this post by Lukas Renggli
On Oct 3, 2007, at 3:19 , Lukas Renggli wrote:
>> I am looking for a class that displays the call tree of an executed >> block of code. > > MessageTally spyOn: [ 1000 factorial ] That is only a sampling time profiler. A call tree you get by doing MessageTally tallySends: [42.0 printString] - Bert - |
In reply to this post by Travis Kay
I like this one. Thanks for pointing it out.
Rob On Oct 2, 2007, at 7:29 PM, Travis Kay wrote: > I typically find myself using TimeProfileBrowser more often. > > TimeProfileBrowser onBlock: [ 1000 factorial ] > > Travis > > Robert Withers wrote: >> Yes, that looks familiar now that I see it. >> >> thanks, >> Rob >> >> On Oct 2, 2007, at 6:19 PM, Lukas Renggli wrote: >> >>>> I am looking for a class that displays the call tree of an executed >>>> block of code. >>> >>> MessageTally spyOn: [ 1000 factorial ] >>> >>> Cheers, >>> Lukas >>> >>> -- >>> Lukas Renggli >>> http://www.lukas-renggli.ch >>> >> >> > > |
In reply to this post by Bert Freudenberg
As promising as this was, it killed my image. I don't know why.
Luckily, all changes are saved! I love Smalltalk! Rob On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: > On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: > >>> I am looking for a class that displays the call tree of an executed >>> block of code. >> >> MessageTally spyOn: [ 1000 factorial ] > > That is only a sampling time profiler. A call tree you get by doing > > MessageTally tallySends: [42.0 printString] > > - Bert - > > > |
Can you share what you executed that crashed your image?
Which image and vm versions? Travis Robert Withers wrote: > As promising as this was, it killed my image. I don't know why. > Luckily, all changes are saved! I love Smalltalk! > > Rob > > On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: > >> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >> >>>> I am looking for a class that displays the call tree of an executed >>>> block of code. >>> >>> MessageTally spyOn: [ 1000 factorial ] >> >> That is only a sampling time profiler. A call tree you get by doing >> >> MessageTally tallySends: [42.0 printString] >> >> - Bert - >> >> >> > > |
Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. I
am running an image started from Squeak3.10alpha.7081.image or so. I am not sure of the exact update number since I don't have that root image around anymore. I have loaded everything specified for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then ran this code, with appropriate values inserted for user and host: MessageTally tallySends: [SSH runBy: user to: host port: 22]. It ran for a bit then crashed. Rob On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: > Can you share what you executed that crashed your image? > Which image and vm versions? > > Travis > > Robert Withers wrote: >> As promising as this was, it killed my image. I don't know why. >> Luckily, all changes are saved! I love Smalltalk! >> >> Rob >> >> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: >> >>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >>> >>>>> I am looking for a class that displays the call tree of an >>>>> executed >>>>> block of code. >>>> >>>> MessageTally spyOn: [ 1000 factorial ] >>> >>> That is only a sampling time profiler. A call tree you get by doing >>> >>> MessageTally tallySends: [42.0 printString] >>> >>> - Bert - >>> >>> >>> >> >> > > |
This is reproducible and not limited to the vm I specified. I also
ran this with vm: 'Squeak 3.8.12beta4U.app' and it crashed. Also, it crashes almost immediately, unlike what I said earlier. Also, there are several problems. The crash is described below. I am also getting code simulation errors using MessageTally tallySends: [...]. I think this sets up the crash. I dug into the code and this is what I found. This code crashes the vm: Socket new connectTo: 1 port: 80. I call #connectTo:port: with an argument of 1 due to interference by the MessageTally. When I run the code below I crash: | addr s | Socket initializeNetwork. MessageTally tallySends: [ addr := NetNameResolver addressForName: 'www.google.org'. (s := SafeSocket new) connectTo: addr port: 80. s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. ]. and when I run this code the result is 1. | addr s | Socket initializeNetwork. MessageTally tallySends: [ addr := NetNameResolver addressForName: 'www.google.org'. ]. addr I hope this helps, Rob On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: > Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. > I am running an image started from Squeak3.10alpha.7081.image or > so. I am not sure of the exact update number since I don't have > that root image around anymore. I have loaded everything specified > for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then ran this > code, with appropriate values inserted for user and host: > > MessageTally tallySends: [SSH runBy: user to: host port: 22]. > > It ran for a bit then crashed. > > Rob > > On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: > >> Can you share what you executed that crashed your image? >> Which image and vm versions? >> >> Travis >> >> Robert Withers wrote: >>> As promising as this was, it killed my image. I don't know why. >>> Luckily, all changes are saved! I love Smalltalk! >>> >>> Rob >>> >>> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: >>> >>>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >>>> >>>>>> I am looking for a class that displays the call tree of an >>>>>> executed >>>>>> block of code. >>>>> >>>>> MessageTally spyOn: [ 1000 factorial ] >>>> >>>> That is only a sampling time profiler. A call tree you get by doing >>>> >>>> MessageTally tallySends: [42.0 printString] >>>> >>>> - Bert - >>>> >>>> >>>> >>> >>> >> >> > > |
#tallySends: simulates the code rather than running it. It will trip
over the same things that can't be simulated as the debugger's "step" button. I guess code using semaphore like the network code won't work. - Bert - On Oct 3, 2007, at 20:15 , Robert Withers wrote: > This is reproducible and not limited to the vm I specified. I also > ran this with vm: 'Squeak 3.8.12beta4U.app' and it crashed. Also, > it crashes almost immediately, unlike what I said earlier. Also, > there are several problems. The crash is described below. I am > also getting code simulation errors using MessageTally tallySends: > [...]. I think this sets up the crash. > > I dug into the code and this is what I found. This code crashes > the vm: > > Socket new connectTo: 1 port: 80. > > I call #connectTo:port: with an argument of 1 due to interference > by the MessageTally. When I run the code below I crash: > > | addr s | > Socket initializeNetwork. > MessageTally tallySends: [ > addr := NetNameResolver addressForName: 'www.google.org'. > (s := SafeSocket new) connectTo: addr port: 80. > s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. > ]. > > and when I run this code the result is 1. > | addr s | > Socket initializeNetwork. > MessageTally tallySends: [ > addr := NetNameResolver addressForName: 'www.google.org'. > ]. > addr > > I hope this helps, > Rob > > On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: > >> Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. >> I am running an image started from Squeak3.10alpha.7081.image or >> so. I am not sure of the exact update number since I don't have >> that root image around anymore. I have loaded everything >> specified for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then >> ran this code, with appropriate values inserted for user and host: >> >> MessageTally tallySends: [SSH runBy: user to: host port: 22]. >> >> It ran for a bit then crashed. >> >> Rob >> >> On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: >> >>> Can you share what you executed that crashed your image? >>> Which image and vm versions? >>> >>> Travis >>> >>> Robert Withers wrote: >>>> As promising as this was, it killed my image. I don't know >>>> why. Luckily, all changes are saved! I love Smalltalk! >>>> >>>> Rob >>>> >>>> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: >>>> >>>>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >>>>> >>>>>>> I am looking for a class that displays the call tree of an >>>>>>> executed >>>>>>> block of code. >>>>>> >>>>>> MessageTally spyOn: [ 1000 factorial ] >>>>> >>>>> That is only a sampling time profiler. A call tree you get by >>>>> doing >>>>> >>>>> MessageTally tallySends: [42.0 printString] >>>>> >>>>> - Bert - |
In reply to this post by Rob Withers
A crash log, or log from your console would be helpful.
On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: > Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. > I am running an image started from Squeak3.10alpha.7081.image or > so. I am not sure of the exact update number since I don't have > that root image around anymore. I have loaded everything specified > for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then ran this > code, with appropriate values inserted for user and host: > > MessageTally tallySends: [SSH runBy: user to: host port: 22]. > > It ran for a bit then crashed. > > Rob ======================================================================== === John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== === |
In reply to this post by Rob Withers
On Oct 3, 2007, at 11:15 AM, Robert Withers wrote: > This is reproducible and not limited to the vm I specified. Well EXPORT(sqInt) primitiveSocketConnectToPort(void) { sqInt addr; sqInt okToConnect; SocketPtr s; sqInt socket; char *address; sqInt port; socket = interpreterProxy->stackValue(2); interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy- >stackValue(1))); address = ((char *) (interpreterProxy->firstIndexableField (interpreterProxy->stackValue(1)))); dies with memory read exception in interpreterProxy- >firstIndexableField() void * firstIndexableField(sqInt oop) { register struct foo * foo = &fum; sqInt fmt; sqInt totalLength; sqInt hdr; sqInt fixedFields; sqInt sz; sqInt class; sqInt classFormat; sqInt ccIndex; hdr = longAt(oop); because oops, via interpreterProxy->stackValue(1) has the value of (3) so it's a number 3, not an oops location (aka 32bit address) longat:(3) is of course invalid I'd suggest someone look at tryNamedPrimitiveIn: aCompiledMethod for: aReceiver withArgs: arguments to see why it's passing bad data. (gdb) call printAllStacks(0) Process 389589848 ContextPart>tryNamedPrimitiveIn:for:withArgs: 389589756 ContextPart>doPrimitive:method:receiver:args: 389589664 ContextPart>tryPrimitiveFor:receiver:args: 389589204 ContextPart>send:to:with:super: 389589096 ContextPart>send:super:numArgs: 389589004 InstructionStream>interpretExtension:in:for: 389588912 InstructionStream>interpretNextInstructionFor: 389588820 ContextPart>step 389538388 ContextPart>runSimulated:contextAtEachStep: 389538296 MessageTally class>tallySendsTo:inBlock:showTree: 389538112 MessageTally class>tallySends: 389537908 UndefinedObject>DoIt 389532772 Compiler>evaluate:in:to:notifying:ifFail:logged: 389532864 [] in ParagraphEditor>evaluateSelection 389532588 BlockContext>on:do: 389532496 ParagraphEditor>evaluateSelection 389532404 ParagraphEditor>doIt 389532680 [] in ParagraphEditor>doIt: 389532312 Controller>terminateAndInitializeAround: 389532220 ParagraphEditor>doIt: 389531972 ParagraphEditor>dispatchOnCharacter:with: 389531880 TextMorphEditor>dispatchOnCharacter:with: 389531788 ParagraphEditor>readKeyboard 389531696 TextMorphEditor>readKeyboard 389531208 [] in TextMorph>keyStroke: 389531116 TextMorph>handleInteraction:fromEvent: 389531024 TextMorphForEditView>handleInteraction:fromEvent: 389530880 TextMorph>keyStroke: 389530788 TextMorphForEditView>keyStroke: 389530696 TextMorph>handleKeystroke: 389530328 KeyboardEvent>sentTo: 389530236 Morph>handleEvent: 389530144 Morph>handleFocusEvent: 389530420 [] in HandMorph>sendFocusEvent:to:clear: 389530512 [] in PasteUpMorph>becomeActiveDuring: 389530052 BlockContext>on:do: 389529960 PasteUpMorph>becomeActiveDuring: 389529736 HandMorph>sendFocusEvent:to:clear: 389529644 HandMorph>sendEvent:focus:clear: 389529552 HandMorph>sendKeyboardEvent: 389529460 HandMorph>handleEvent: 389529240 HandMorph>processEvents 389529332 [] in WorldState>doOneCycleNowFor: 389529148 SequenceableCollection>do: 389529056 WorldState>handsDo: 389528964 WorldState>doOneCycleNowFor: 389528872 WorldState>doOneCycleFor: 389528780 PasteUpMorph>doOneCycle 386845716 [] in Project class>spawnNewProcess 386845900 [] in BlockContext>newProcess -- ======================================================================== === John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== === |
In reply to this post by Rob Withers
I know nothing about code simulation. I really need to run the InterpreterSimulator and learn, considering the vm changes I want to make for my research. I didn't know semaphores trip it up. Is there no way to repair that? This would explain the call to NetNameResolver>>#addressForName: returning garbage.
Rob
----- Original Message ---- From: Bert Freudenberg <[hidden email]> To: The general-purpose Squeak developers list <[hidden email]> Sent: Wednesday, October 3, 2007 1:14:09 PM Subject: Re: Is there a message profiler in Squeak? #tallySends: simulates the code rather than running it. It will trip
over the same things that can't be simulated as the debugger's "step" button. I guess code using semaphore like the network code won't work. - Bert - On Oct 3, 2007, at 20:15 , Robert Withers wrote: > This is reproducible and not limited to the vm I specified. I also > ran this with vm: 'Squeak 3.8.12beta4U.app' and it crashed. Also, > it crashes almost immediately, unlike what I said earlier. Also, > there are several problems. The crash is described below. I am > also getting code simulation errors using MessageTally tallySends: > [...]. I think this sets up the crash. > > I dug into the code and this is what I found. This code crashes > the vm: > > Socket new connectTo: 1 port: 80. > > I call #connectTo:port: with an argument of 1 due to interference > by the MessageTally. When I run the code below I crash: > > | addr s | > Socket initializeNetwork. > MessageTally tallySends: [ > addr := NetNameResolver addressForName: 'www.google.org'. > (s := SafeSocket new) connectTo: addr port: 80. > s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. > ]. > > and when I run this code the result is 1. > | addr s | > Socket initializeNetwork. > MessageTally tallySends: [ > addr := NetNameResolver addressForName: 'www.google.org'. > ]. > addr > > I hope this helps, > Rob > > On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: > >> Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. >> I am running an image started from Squeak3.10alpha.7081.image or >> so. I am not sure of the exact update number since I don't have >> that root image around anymore. I have loaded everything >> specified for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then >> ran this code, with appropriate values inserted for user and host: >> >> MessageTally tallySends: [SSH runBy: user to: host port: 22]. >> >> It ran for a bit then crashed. >> >> Rob >> >> On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: >> >>> Can you share what you executed that crashed your image? >>> Which image and vm versions? >>> >>> Travis >>> >>> Robert Withers wrote: >>>> As promising as this was, it killed my image. I don't know >>>> why. Luckily, all changes are saved! I love Smalltalk! >>>> >>>> Rob >>>> >>>> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: >>>> >>>>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >>>>> >>>>>>> I am looking for a class that displays the call tree of an >>>>>>> executed >>>>>>> block of code. >>>>>> >>>>>> MessageTally spyOn: [ 1000 factorial ] >>>>> >>>>> That is only a sampling time profiler. A call tree you get by >>>>> doing >>>>> >>>>> MessageTally tallySends: [42.0 printString] >>>>> >>>>> - Bert - |
This has not that much to do with the InterpreterSimulator - although
it is indeed yet another bytecode interpreter interpreter (see ContextPart>>step) - Bert - On Oct 3, 2007, at 23:17 , Rob Withers wrote: > I know nothing about code simulation. I really need to run the > InterpreterSimulator and learn, considering the vm changes I want > to make for my research. I didn't know semaphores trip it up. Is > there no way to repair that? This would explain the call to > NetNameResolver>>#addressForName: returning garbage. > > Rob > > ----- Original Message ---- > From: Bert Freudenberg <[hidden email]> > To: The general-purpose Squeak developers list <squeak- > [hidden email]> > Sent: Wednesday, October 3, 2007 1:14:09 PM > Subject: Re: Is there a message profiler in Squeak? > > #tallySends: simulates the code rather than running it. It will trip > over the same things that can't be simulated as the debugger's "step" > button. I guess code using semaphore like the network code won't work. > > - Bert - > > On Oct 3, 2007, at 20:15 , Robert Withers wrote: > > > This is reproducible and not limited to the vm I specified. I also > > ran this with vm: 'Squeak 3.8.12beta4U.app' and it crashed. Also, > > it crashes almost immediately, unlike what I said earlier. Also, > > there are several problems. The crash is described below. I am > > also getting code simulation errors using MessageTally tallySends: > > [...]. I think this sets up the crash. > > > > I dug into the code and this is what I found. This code crashes > > the vm: > > > > Socket new connectTo: 1 port: 80. > > > > I call #connectTo:port: with an argument of 1 due to interference > > by the MessageTally. When I run the code below I crash: > > > > | addr s | > > Socket initializeNetwork. > > MessageTally tallySends: [ > > addr := NetNameResolver addressForName: 'www.google.org'. > > (s := SafeSocket new) connectTo: addr port: 80. > > s waitForConnectionFor: Socket standardTimeout > ifTimedOut: []. > > ]. > > > > and when I run this code the result is 1. > > | addr s | > > Socket initializeNetwork. > > MessageTally tallySends: [ > > addr := NetNameResolver addressForName: 'www.google.org'. > > ]. > > addr > > > > I hope this helps, > > Rob > > > > On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: > > > >> Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. > >> I am running an image started from Squeak3.10alpha.7081.image or > >> so. I am not sure of the exact update number since I don't have > >> that root image around anymore. I have loaded everything > >> specified for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then > >> ran this code, with appropriate values inserted for user and host: > >> > >> MessageTally tallySends: [SSH runBy: user to: host port: 22]. > >> > >> It ran for a bit then crashed. > >> > >> Rob > >> > >> On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: > >> > >>> Can you share what you executed that crashed your image? > >>> Which image and vm versions? > >>> > >>> Travis > >>> > >>> Robert Withers wrote: > >>>> As promising as this was, it killed my image. I don't know > >>>> why. Luckily, all changes are saved! I love Smalltalk! > >>>> > >>>> Rob > >>>> > >>>> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: > >>>> > >>>>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: > >>>>> > >>>>>>> I am looking for a class that displays the call tree of an > >>>>>>> executed > >>>>>>> block of code. > >>>>>> > >>>>>> MessageTally spyOn: [ 1000 factorial ] > >>>>> > >>>>> That is only a sampling time profiler. A call tree you get by > >>>>> doing > >>>>> > >>>>> MessageTally tallySends: [42.0 printString] > >>>>> > >>>>> - Bert - > > |
In reply to this post by johnmci
Why does interpreterProxy->isBytes(interpreterProxy->stackValue(1))
return true for an integer? It would be better to have protection over the arguments, such that an integer arg would cause a primitiveFailure rather than a seg fault. The reason an integer is passed in is from this code: > | addr s | > Socket initializeNetwork. > MessageTally tallySends: [ > addr := NetNameResolver addressForName: 'www.google.org'. > (s := SafeSocket new) connectTo: addr port: 80. > s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. > ]. where the call to NetNameResolver addressForName: 'www.google.org'. returns an integer when it is simulated with tallySends:. I don't know why simulation of this causes it to do this. Rob On Oct 3, 2007, at 1:43 PM, John M McIntosh wrote: > > On Oct 3, 2007, at 11:15 AM, Robert Withers wrote: > >> This is reproducible and not limited to the vm I specified. > > Well > EXPORT(sqInt) primitiveSocketConnectToPort(void) { > sqInt addr; > sqInt okToConnect; > SocketPtr s; > sqInt socket; > char *address; > sqInt port; > > socket = interpreterProxy->stackValue(2); > interpreterProxy->success(interpreterProxy->isBytes > (interpreterProxy->stackValue(1))); > address = ((char *) (interpreterProxy->firstIndexableField > (interpreterProxy->stackValue(1)))); > > > dies with memory read exception in interpreterProxy- > >firstIndexableField() > > void * firstIndexableField(sqInt oop) { > register struct foo * foo = &fum; > sqInt fmt; > sqInt totalLength; > sqInt hdr; > sqInt fixedFields; > sqInt sz; > sqInt class; > sqInt classFormat; > sqInt ccIndex; > > hdr = longAt(oop); > > because oops, via interpreterProxy->stackValue(1) has the value of > (3) so it's a number 3, not an oops location (aka 32bit address) > > longat:(3) is of course invalid > > > I'd suggest someone look at > tryNamedPrimitiveIn: aCompiledMethod for: aReceiver withArgs: > arguments > > to see why it's passing bad data. > > (gdb) call printAllStacks(0) > Process > 389589848 ContextPart>tryNamedPrimitiveIn:for:withArgs: > 389589756 ContextPart>doPrimitive:method:receiver:args: > 389589664 ContextPart>tryPrimitiveFor:receiver:args: > 389589204 ContextPart>send:to:with:super: > 389589096 ContextPart>send:super:numArgs: > 389589004 InstructionStream>interpretExtension:in:for: > 389588912 InstructionStream>interpretNextInstructionFor: > 389588820 ContextPart>step > 389538388 ContextPart>runSimulated:contextAtEachStep: > 389538296 MessageTally class>tallySendsTo:inBlock:showTree: > 389538112 MessageTally class>tallySends: > 389537908 UndefinedObject>DoIt > 389532772 Compiler>evaluate:in:to:notifying:ifFail:logged: > 389532864 [] in ParagraphEditor>evaluateSelection > 389532588 BlockContext>on:do: > 389532496 ParagraphEditor>evaluateSelection > 389532404 ParagraphEditor>doIt > 389532680 [] in ParagraphEditor>doIt: > 389532312 Controller>terminateAndInitializeAround: > 389532220 ParagraphEditor>doIt: > 389531972 ParagraphEditor>dispatchOnCharacter:with: > 389531880 TextMorphEditor>dispatchOnCharacter:with: > 389531788 ParagraphEditor>readKeyboard > 389531696 TextMorphEditor>readKeyboard > 389531208 [] in TextMorph>keyStroke: > 389531116 TextMorph>handleInteraction:fromEvent: > 389531024 TextMorphForEditView>handleInteraction:fromEvent: > 389530880 TextMorph>keyStroke: > 389530788 TextMorphForEditView>keyStroke: > 389530696 TextMorph>handleKeystroke: > 389530328 KeyboardEvent>sentTo: > 389530236 Morph>handleEvent: > 389530144 Morph>handleFocusEvent: > 389530420 [] in HandMorph>sendFocusEvent:to:clear: > 389530512 [] in PasteUpMorph>becomeActiveDuring: > 389530052 BlockContext>on:do: > 389529960 PasteUpMorph>becomeActiveDuring: > 389529736 HandMorph>sendFocusEvent:to:clear: > 389529644 HandMorph>sendEvent:focus:clear: > 389529552 HandMorph>sendKeyboardEvent: > 389529460 HandMorph>handleEvent: > 389529240 HandMorph>processEvents > 389529332 [] in WorldState>doOneCycleNowFor: > 389529148 SequenceableCollection>do: > 389529056 WorldState>handsDo: > 389528964 WorldState>doOneCycleNowFor: > 389528872 WorldState>doOneCycleFor: > 389528780 PasteUpMorph>doOneCycle > 386845716 [] in Project class>spawnNewProcess > 386845900 [] in BlockContext>newProcess > > > -- > ====================================================================== > ===== > John M. McIntosh <[hidden email]> > Corporate Smalltalk Consulting Ltd. http:// > www.smalltalkconsulting.com > ====================================================================== > ===== > > > |
In reply to this post by Bert Freudenberg
I looked at that method (#step) and called methods and I sort of see
how they interprets bytecodes. Are you saying there is no way to call a primitive in the vm from this interpreted code in the image? How about a bytecode function? I have intentions of being able to do this for my research. I need to be able to execute a bytecode function in the vm with the receiver and args and a bytecode specifying which function to call. What would it take to allow this? How about a primitive? thanks, Rob On Oct 3, 2007, at 3:05 PM, Bert Freudenberg wrote: > This has not that much to do with the InterpreterSimulator - > although it is indeed yet another bytecode interpreter interpreter > (see ContextPart>>step) > > - Bert - > > > On Oct 3, 2007, at 23:17 , Rob Withers wrote: > >> I know nothing about code simulation. I really need to run the >> InterpreterSimulator and learn, considering the vm changes I want >> to make for my research. I didn't know semaphores trip it up. Is >> there no way to repair that? This would explain the call to >> NetNameResolver>>#addressForName: returning garbage. >> >> Rob >> >> ----- Original Message ---- >> From: Bert Freudenberg <[hidden email]> >> To: The general-purpose Squeak developers list <squeak- >> [hidden email]> >> Sent: Wednesday, October 3, 2007 1:14:09 PM >> Subject: Re: Is there a message profiler in Squeak? >> >> #tallySends: simulates the code rather than running it. It will trip >> over the same things that can't be simulated as the debugger's "step" >> button. I guess code using semaphore like the network code won't >> work. >> >> - Bert - >> >> On Oct 3, 2007, at 20:15 , Robert Withers wrote: >> >> > This is reproducible and not limited to the vm I specified. I also >> > ran this with vm: 'Squeak 3.8.12beta4U.app' and it crashed. Also, >> > it crashes almost immediately, unlike what I said earlier. Also, >> > there are several problems. The crash is described below. I am >> > also getting code simulation errors using MessageTally tallySends: >> > [...]. I think this sets up the crash. >> > >> > I dug into the code and this is what I found. This code crashes >> > the vm: >> > >> > Socket new connectTo: 1 port: 80. >> > >> > I call #connectTo:port: with an argument of 1 due to interference >> > by the MessageTally. When I run the code below I crash: >> > >> > | addr s | >> > Socket initializeNetwork. >> > MessageTally tallySends: [ >> > addr := NetNameResolver addressForName: 'www.google.org'. >> > (s := SafeSocket new) connectTo: addr port: 80. >> > s waitForConnectionFor: Socket standardTimeout >> ifTimedOut: []. >> > ]. >> > >> > and when I run this code the result is 1. >> > | addr s | >> > Socket initializeNetwork. >> > MessageTally tallySends: [ >> > addr := NetNameResolver addressForName: 'www.google.org'. >> > ]. >> > addr >> > >> > I hope this helps, >> > Rob >> > >> > On Oct 3, 2007, at 10:16 AM, Robert Withers wrote: >> > >> >> Sure. I am running on a Mac with vm: 'Squeak 3.8.18beta1U.app'. >> >> I am running an image started from Squeak3.10alpha.7081.image or >> >> so. I am not sure of the exact update number since I don't have >> >> that root image around anymore. I have loaded everything >> >> specified for SSH (2 bug fixes, telnet, Crypto, SSL, SSH). I then >> >> ran this code, with appropriate values inserted for user and host: >> >> >> >> MessageTally tallySends: [SSH runBy: user to: host port: 22]. >> >> >> >> It ran for a bit then crashed. >> >> >> >> Rob >> >> >> >> On Oct 3, 2007, at 9:59 AM, Travis Kay wrote: >> >> >> >>> Can you share what you executed that crashed your image? >> >>> Which image and vm versions? >> >>> >> >>> Travis >> >>> >> >>> Robert Withers wrote: >> >>>> As promising as this was, it killed my image. I don't know >> >>>> why. Luckily, all changes are saved! I love Smalltalk! >> >>>> >> >>>> Rob >> >>>> >> >>>> On Oct 3, 2007, at 3:02 AM, Bert Freudenberg wrote: >> >>>> >> >>>>> On Oct 3, 2007, at 3:19 , Lukas Renggli wrote: >> >>>>> >> >>>>>>> I am looking for a class that displays the call tree of an >> >>>>>>> executed >> >>>>>>> block of code. >> >>>>>> >> >>>>>> MessageTally spyOn: [ 1000 factorial ] >> >>>>> >> >>>>> That is only a sampling time profiler. A call tree you get by >> >>>>> doing >> >>>>> >> >>>>> MessageTally tallySends: [42.0 printString] >> >>>>> >> >>>>> - Bert - >> >> > > > > > |
In reply to this post by Rob Withers
It has that protection:
ObjectMemory>>isBytes: oop "Answer true if the argument contains indexable bytes. See comment in formatOf:" "Note: Includes CompiledMethods." ^(self isNonIntegerObject: oop) and:[self isBytesNonInt: oop] Cheers, - Andreas Robert Withers wrote: > Why does interpreterProxy->isBytes(interpreterProxy->stackValue(1)) > return true for an integer? It would be better to have protection over > the arguments, such that an integer arg would cause a primitiveFailure > rather than a seg fault. > > The reason an integer is passed in is from this code: >> | addr s | >> Socket initializeNetwork. >> MessageTally tallySends: [ >> addr := NetNameResolver addressForName: 'www.google.org'. >> (s := SafeSocket new) connectTo: addr port: 80. >> s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. >> ]. > where the call to NetNameResolver addressForName: 'www.google.org'. > returns an integer when it is simulated with tallySends:. I don't know > why simulation of this causes it to do this. > > Rob > > On Oct 3, 2007, at 1:43 PM, John M McIntosh wrote: > >> >> On Oct 3, 2007, at 11:15 AM, Robert Withers wrote: >> >>> This is reproducible and not limited to the vm I specified. >> >> Well >> EXPORT(sqInt) primitiveSocketConnectToPort(void) { >> sqInt addr; >> sqInt okToConnect; >> SocketPtr s; >> sqInt socket; >> char *address; >> sqInt port; >> >> socket = interpreterProxy->stackValue(2); >> interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); >> >> address = ((char *) >> (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); >> >> >> >> dies with memory read exception in >> interpreterProxy->firstIndexableField() >> >> void * firstIndexableField(sqInt oop) { >> register struct foo * foo = &fum; >> sqInt fmt; >> sqInt totalLength; >> sqInt hdr; >> sqInt fixedFields; >> sqInt sz; >> sqInt class; >> sqInt classFormat; >> sqInt ccIndex; >> >> hdr = longAt(oop); >> >> because oops, via interpreterProxy->stackValue(1) has the value of >> (3) so it's a number 3, not an oops location (aka 32bit address) >> >> longat:(3) is of course invalid >> >> >> I'd suggest someone look at >> tryNamedPrimitiveIn: aCompiledMethod for: aReceiver withArgs: arguments >> >> to see why it's passing bad data. >> >> (gdb) call printAllStacks(0) >> Process >> 389589848 ContextPart>tryNamedPrimitiveIn:for:withArgs: >> 389589756 ContextPart>doPrimitive:method:receiver:args: >> 389589664 ContextPart>tryPrimitiveFor:receiver:args: >> 389589204 ContextPart>send:to:with:super: >> 389589096 ContextPart>send:super:numArgs: >> 389589004 InstructionStream>interpretExtension:in:for: >> 389588912 InstructionStream>interpretNextInstructionFor: >> 389588820 ContextPart>step >> 389538388 ContextPart>runSimulated:contextAtEachStep: >> 389538296 MessageTally class>tallySendsTo:inBlock:showTree: >> 389538112 MessageTally class>tallySends: >> 389537908 UndefinedObject>DoIt >> 389532772 Compiler>evaluate:in:to:notifying:ifFail:logged: >> 389532864 [] in ParagraphEditor>evaluateSelection >> 389532588 BlockContext>on:do: >> 389532496 ParagraphEditor>evaluateSelection >> 389532404 ParagraphEditor>doIt >> 389532680 [] in ParagraphEditor>doIt: >> 389532312 Controller>terminateAndInitializeAround: >> 389532220 ParagraphEditor>doIt: >> 389531972 ParagraphEditor>dispatchOnCharacter:with: >> 389531880 TextMorphEditor>dispatchOnCharacter:with: >> 389531788 ParagraphEditor>readKeyboard >> 389531696 TextMorphEditor>readKeyboard >> 389531208 [] in TextMorph>keyStroke: >> 389531116 TextMorph>handleInteraction:fromEvent: >> 389531024 TextMorphForEditView>handleInteraction:fromEvent: >> 389530880 TextMorph>keyStroke: >> 389530788 TextMorphForEditView>keyStroke: >> 389530696 TextMorph>handleKeystroke: >> 389530328 KeyboardEvent>sentTo: >> 389530236 Morph>handleEvent: >> 389530144 Morph>handleFocusEvent: >> 389530420 [] in HandMorph>sendFocusEvent:to:clear: >> 389530512 [] in PasteUpMorph>becomeActiveDuring: >> 389530052 BlockContext>on:do: >> 389529960 PasteUpMorph>becomeActiveDuring: >> 389529736 HandMorph>sendFocusEvent:to:clear: >> 389529644 HandMorph>sendEvent:focus:clear: >> 389529552 HandMorph>sendKeyboardEvent: >> 389529460 HandMorph>handleEvent: >> 389529240 HandMorph>processEvents >> 389529332 [] in WorldState>doOneCycleNowFor: >> 389529148 SequenceableCollection>do: >> 389529056 WorldState>handsDo: >> 389528964 WorldState>doOneCycleNowFor: >> 389528872 WorldState>doOneCycleFor: >> 389528780 PasteUpMorph>doOneCycle >> 386845716 [] in Project class>spawnNewProcess >> 386845900 [] in BlockContext>newProcess >> >> >> -- >> =========================================================================== >> >> John M. McIntosh <[hidden email]> >> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com >> =========================================================================== >> >> >> >> > > > |
The #isBytes: method has the proper check, but the slang code generator for
SmartSyntaxInterpreterPlugin is not properly making use of the check. The SocketPlugin method contains this declaration: self primitive: 'primitiveSocketConnectToPort' parameters: #(#Oop #ByteArray #SmallInteger ). which is translated to this: socket = interpreterProxy->stackValue(2); interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); address = ((char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); port = interpreterProxy->stackIntegerValue(0); if (interpreterProxy->failed()) { return null; } so the check for interpreterProxy->failed() is not happening until after stackValue(1) has been used as a ByteArray, despite the prior test for #isBytes. Dave On Wed, Oct 03, 2007 at 07:48:38PM -0700, Andreas Raab wrote: > It has that protection: > > ObjectMemory>>isBytes: oop > "Answer true if the argument contains indexable bytes. See comment > in formatOf:" > "Note: Includes CompiledMethods." > ^(self isNonIntegerObject: oop) and:[self isBytesNonInt: oop] > > Cheers, > - Andreas > > Robert Withers wrote: > >Why does interpreterProxy->isBytes(interpreterProxy->stackValue(1)) > >return true for an integer? It would be better to have protection over > >the arguments, such that an integer arg would cause a primitiveFailure > >rather than a seg fault. > > > >The reason an integer is passed in is from this code: > >> | addr s | > >> Socket initializeNetwork. > >> MessageTally tallySends: [ > >> addr := NetNameResolver addressForName: 'www.google.org'. > >> (s := SafeSocket new) connectTo: addr port: 80. > >> s waitForConnectionFor: Socket standardTimeout ifTimedOut: []. > >> ]. > >where the call to NetNameResolver addressForName: 'www.google.org'. > >returns an integer when it is simulated with tallySends:. I don't know > >why simulation of this causes it to do this. > > > >Rob > > > >On Oct 3, 2007, at 1:43 PM, John M McIntosh wrote: > > > >> > >>On Oct 3, 2007, at 11:15 AM, Robert Withers wrote: > >> > >>>This is reproducible and not limited to the vm I specified. > >> > >>Well > >>EXPORT(sqInt) primitiveSocketConnectToPort(void) { > >> sqInt addr; > >> sqInt okToConnect; > >> SocketPtr s; > >> sqInt socket; > >> char *address; > >> sqInt port; > >> > >> socket = interpreterProxy->stackValue(2); > >> interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); > >> > >> address = ((char *) > >>(interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); > >> > >> > >> > >>dies with memory read exception in > >>interpreterProxy->firstIndexableField() > >> > >>void * firstIndexableField(sqInt oop) { > >>register struct foo * foo = &fum; > >> sqInt fmt; > >> sqInt totalLength; > >> sqInt hdr; > >> sqInt fixedFields; > >> sqInt sz; > >> sqInt class; > >> sqInt classFormat; > >> sqInt ccIndex; > >> > >> hdr = longAt(oop); > >> > >>because oops, via interpreterProxy->stackValue(1) has the value of > >>(3) so it's a number 3, not an oops location (aka 32bit address) > >> > >>longat:(3) is of course invalid > >> > >> > >>I'd suggest someone look at > >>tryNamedPrimitiveIn: aCompiledMethod for: aReceiver withArgs: arguments > >> > >>to see why it's passing bad data. > >> > >>(gdb) call printAllStacks(0) > >>Process > >>389589848 ContextPart>tryNamedPrimitiveIn:for:withArgs: > >>389589756 ContextPart>doPrimitive:method:receiver:args: > >>389589664 ContextPart>tryPrimitiveFor:receiver:args: > >>389589204 ContextPart>send:to:with:super: > >>389589096 ContextPart>send:super:numArgs: > >>389589004 InstructionStream>interpretExtension:in:for: > >>389588912 InstructionStream>interpretNextInstructionFor: > >>389588820 ContextPart>step > >>389538388 ContextPart>runSimulated:contextAtEachStep: > >>389538296 MessageTally class>tallySendsTo:inBlock:showTree: > >>389538112 MessageTally class>tallySends: > >>389537908 UndefinedObject>DoIt > >>389532772 Compiler>evaluate:in:to:notifying:ifFail:logged: > >>389532864 [] in ParagraphEditor>evaluateSelection > >>389532588 BlockContext>on:do: > >>389532496 ParagraphEditor>evaluateSelection > >>389532404 ParagraphEditor>doIt > >>389532680 [] in ParagraphEditor>doIt: > >>389532312 Controller>terminateAndInitializeAround: > >>389532220 ParagraphEditor>doIt: > >>389531972 ParagraphEditor>dispatchOnCharacter:with: > >>389531880 TextMorphEditor>dispatchOnCharacter:with: > >>389531788 ParagraphEditor>readKeyboard > >>389531696 TextMorphEditor>readKeyboard > >>389531208 [] in TextMorph>keyStroke: > >>389531116 TextMorph>handleInteraction:fromEvent: > >>389531024 TextMorphForEditView>handleInteraction:fromEvent: > >>389530880 TextMorph>keyStroke: > >>389530788 TextMorphForEditView>keyStroke: > >>389530696 TextMorph>handleKeystroke: > >>389530328 KeyboardEvent>sentTo: > >>389530236 Morph>handleEvent: > >>389530144 Morph>handleFocusEvent: > >>389530420 [] in HandMorph>sendFocusEvent:to:clear: > >>389530512 [] in PasteUpMorph>becomeActiveDuring: > >>389530052 BlockContext>on:do: > >>389529960 PasteUpMorph>becomeActiveDuring: > >>389529736 HandMorph>sendFocusEvent:to:clear: > >>389529644 HandMorph>sendEvent:focus:clear: > >>389529552 HandMorph>sendKeyboardEvent: > >>389529460 HandMorph>handleEvent: > >>389529240 HandMorph>processEvents > >>389529332 [] in WorldState>doOneCycleNowFor: > >>389529148 SequenceableCollection>do: > >>389529056 WorldState>handsDo: > >>389528964 WorldState>doOneCycleNowFor: > >>389528872 WorldState>doOneCycleFor: > >>389528780 PasteUpMorph>doOneCycle > >>386845716 [] in Project class>spawnNewProcess > >>386845900 [] in BlockContext>newProcess > >> > >> > >>-- > >>=========================================================================== > >> > >>John M. McIntosh <[hidden email]> > >>Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com > >>=========================================================================== > >> > >> > >> > >> > > > > > > > |
Free forum by Nabble | Edit this page |