Has anyone made a tool to explore the messages send hierarchy caused
by evaluating a piece of code in Smalltalk? As an example, consider evaluating #last in the following statement: #(3 4) last The output of the message send explorer would be similar to this: Array(SequenceableCollection)>>last Array(Collection)>>emptyCheck Array(Collection)>>isEmpty Array(ArrayedCollection)>>size SmallInteger>>= False(Boolean)>>ifTrue: Array(ArrayedCollection)>>size Array(Object)>>at: As you can see, each sub-level lists all message sends in the level above. TimeProfiler has a similar output, but I am not looking for profiling the code. I just want to find out which code is executed when running a given statement. It could be helpful when trying to understand a piece of code. Runar |
What you are looking for is a Tracer.
A class probe for received messages could help to emulate something you are looking for, but .. you would have to probe all classes to get the desired trace-run output. Perhaps Terry Raymond has an idea? Roland Wagener -- Senior Consultant at Georg Heeg eK VisualWorks Ambassador phone: x49-231-9 75 99-26 fax: x49-231-9 75 99-20 email: [hidden email] www: http://www.heeg.de/~roland Runar Jordahl schrieb: > Has anyone made a tool to explore the messages send hierarchy caused > by evaluating a piece of code in Smalltalk? > > As an example, consider evaluating #last in the following statement: > #(3 4) last > > The output of the message send explorer would be similar to this: > Array(SequenceableCollection)>>last > Array(Collection)>>emptyCheck > Array(Collection)>>isEmpty > Array(ArrayedCollection)>>size > SmallInteger>>= > False(Boolean)>>ifTrue: > Array(ArrayedCollection)>>size > Array(Object)>>at: > > As you can see, each sub-level lists all message sends in the level above. > > TimeProfiler has a similar output, but I am not looking for profiling > the code. I just want to find out which code is executed when running > a given statement. It could be helpful when trying to understand a > piece of code. > > Runar > > |
In reply to this post by Runar Jordahl
The attached parcel provides something I used a while ago. It's undoubtedly rough and unfinished, but I'm pretty sure it worked back then. Unsurprisingly it is based on the MethodWrappers, so you'll need those as well. It adds some menu items to RB, you select classes or methods and mark them as "logging calls", then you mark one method as the "trigger" method. Whenever execution reaches the "trigger" method it will start logging method calls. When it leaves the scope of the trigger method it stops logging and opens an inspector on the log. You'll also want to find the "Nuke All Method Wrappers" menu item when you're done tracing. I have no-idea how badly it can misbehave, e.g. in some recursive triggering scenario, it may just work or it may kill your image, so be careful.
HTH, Martin Runar Jordahl wrote: > Has anyone made a tool to explore the messages send hierarchy caused > by evaluating a piece of code in Smalltalk? > > As an example, consider evaluating #last in the following statement: > #(3 4) last > > The output of the message send explorer would be similar to this: > Array(SequenceableCollection)>>last > Array(Collection)>>emptyCheck > Array(Collection)>>isEmpty > Array(ArrayedCollection)>>size > SmallInteger>>= > False(Boolean)>>ifTrue: > Array(ArrayedCollection)>>size > Array(Object)>>at: > > As you can see, each sub-level lists all message sends in the level above. > > TimeProfiler has a similar output, but I am not looking for profiling > the code. I just want to find out which code is executed when running > a given statement. It could be helpful when trying to understand a > piece of code. > > Runar > > MethodCallTracing.zip (8K) Download Attachment |
Free forum by Nabble | Edit this page |