[squeak-dev] Re: process-faithful debugging?

Eliot Miranda eliot.miranda at gmail.com
Fri Jul 17 04:16:39 UTC 2009


On Thu, Jul 16, 2009 at 6:26 PM, Andreas Raab <andreas.raab at gmx.de> wrote:

> Didn't we talk about this earlier?


Yes we had discussed it, but I needed the reminder...


> Process>>currentProcess
>  "Answer the currently active process.
>  If the receiver is simulating another process,
>  answer the other process. If not, answer self."
>  ^currentProcess ifNil:[self]
>
> Process>>currentProcess: aProcess
>  "Set the currently active process.
>  Return the previous active process."
>  | prior |
>  prior := currentProcess.
>  currentProcess := aProcess.
>  ^prior
>
> ProcessorScheduler>>activeProcess
>  ^activeProcess currentProcess
>
> ProcessorScheduler>>currentProcess: aProcess
>  "For debugging only.
>   Pretend that aProcess is the activeProcess"
>  ^activeProcess currentProcess: aProcess
>
> and then:
>
> Debugger>>step
>  prior := Processor currentProcess: interruptedProcess.
>  [self doStep] ensure:[Processor currentProcess: prior].
>
> etc.


Yes.  This is OK, but it means the system codes to suit the debugger and
that's always felt like the tail wagging the dog to me.

How about creating an anonymous subclass of the process that implements
activeProcess to raise an exception caught by the debugger that answers the
right thing and class (to answer the proper class) and using adoptInstance:
(the new guts of changeClassTo:)  for the duration of each step?

The VW debugger uses something similar to this to do step into.  All blocks
in the current context get their class changed to one that raises an
exception on receiving a value message which the debugger catches, converts
the block back and pauses the computation after the activation of the block.

Eliot Miranda wrote:
>
>> Hi All,
>>
>>    does anyone have a neat hack to make Processor activeProcess answer
>> what's expected in the context of the debugger?  i.e. anyone made the Squeak
>> debugger answer the process being debugger when Processor activeProcess is
>> stepped over or through, rather than the debugger process, or made the
>> debugger run as the process being debugged rather than its own?
>>
>> TIA
>> Eliot
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090716/a793cae5/attachment.htm


More information about the Squeak-dev mailing list