For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > April 2004 > Catching the execution stack in ObjectStudio









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Catching the execution stack in ObjectStudio
Marcelo Pereira Barbosa

2004-04-27, 7:10 pm

Hi

Does anybody know how to catch the execution stack in ObjectStudio
without raising an exception?

thanks
Paul Wallimann

2004-04-28, 3:14 pm

Marcelo Pereira Barbosa wrote:

> Hi
>
> Does anybody know how to catch the execution stack in ObjectStudio
> without raising an exception?
>
> thanks


Marcelo,

Unfortunately, this is not so easy to do in ObjectStudio like it is in other
Smalltalks (thisContext) but I think something like the following could
help you get going:


GlobalDictionary>>getProgramStack

| originalHook depth methodContext string list |

originalHook := self getSendHook.
SendHooks at: #MyTempHook put: [:r :e :a| "Do nothing" ].
self setSendHookTo: #MyTempHook.
depth := self getSendHookContextStackDepth.
self setSendHookTo: originalHook.
SendHooks removeAt: #MyTempHook.

list := OrderedCollection new.
depth to: 1 by: -1 do: [:index |
methodContext := System homeContextStackAt: index.
(methodContext notNil) ifTrue: [
string := methodContext receiverClass name asString.
string := string + '>>' + methodContext selector.
list add: string.
].
].

^list.


Hope this helps,
Paul
Marcelo Pereira Barbosa

2004-04-29, 2:22 pm

Hi, Paul!

This method will be so usefull for us (me and colleagues). Thank you
so much!!!

In time, I would like to congratulate you on those newsgroups messages
about ObjectStudio's future :) ..... mainly, your good humour!!

Thanks/obrigado/gracias/merci

=======
Marcelo Pereira Barbosa



==========
Paul Wallimann <pw@nowhere.com> wrote in message news:<408ff1dc$0$703$5402220f@news.sunrise.ch>...
> Marcelo Pereira Barbosa wrote:
>
>
> Marcelo,
>
> Unfortunately, this is not so easy to do in ObjectStudio like it is in other
> Smalltalks (thisContext) but I think something like the following could
> help you get going:
>
>
> GlobalDictionary>>getProgramStack
>
> | originalHook depth methodContext string list |
>
> originalHook := self getSendHook.
> SendHooks at: #MyTempHook put: [:r :e :a| "Do nothing" ].
> self setSendHookTo: #MyTempHook.
> depth := self getSendHookContextStackDepth.
> self setSendHookTo: originalHook.
> SendHooks removeAt: #MyTempHook.
>
> list := OrderedCollection new.
> depth to: 1 by: -1 do: [:index |
> methodContext := System homeContextStackAt: index.
> (methodContext notNil) ifTrue: [
> string := methodContext receiverClass name asString.
> string := string + '>>' + methodContext selector.
> list add: string.
> ].
> ].
>
> ^list.
>
>
> Hope this helps,
> Paul

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com