�� �� [ let me try again. ��never try and get code out too early in the morning ;-) ]
�� �� it is the debugger that needs fixing, not your code !! :-). ��The debugger needs to respect process identity. ��Andreas and I (mostly Andreas) came up with the following changes at Qwaq. ��Your message is a good reminder that I need to add this to Squeak asap.
The idea is for Process to have an additional inst var 'effectiveProcess' that holds the actual process running code. ��For the most part this is self, but in the debugger we substitute the process being debugged:
Process methods for accessing
effectiveProcess
"effectiveProcess is a mechanism to allow process-faithful debugging. ��The debugger executes code
��on behalf of processes, so unless some effort is made the identity of Processor activeProcess is not
��correctly maintained when debugging code. ��The debugger uses evaluate:onBehalfOf: to assign the
��debugged process as the effectiveProcess of the process executing the code, preserving process
��identity."
^effectiveProcess ifNil: [self]
then the relevant methods in Process and processorScheduler defer to effectiveProcess, e.g.
ProcessorScheduler methods for process state change
terminateActive
"Terminate the process that is currently running."
activeProcess effectiveProcess terminate
and the debugging methods use evaluate:onBehalfOf: to install the process being debugged:
Process methods for private
evaluate: aBlock onBehalfOf: aProcess
"Evaluate aBlock setting effectiveProcess to aProcess. ��Used
��in the execution simulation machinery to ensure that
��Processor activeProcess evaluates correctly when debugging."
| oldEffectiveProcess |
oldEffectiveProcess := effectiveProcess.
effectiveProcess := aProcess.
^aBlock ensure: [effectiveProcess := oldEffectiveProcess]
Process methods for changing suspended state
step
^Processor activeProcess
evaluate: [suspendedContext := suspendedContext step]
onBehalfOf: self
stepToCallee
"Step until top context changes"
Processor activeProcess
evaluate:
[| ctxt |
ctxt := suspendedContext.
[ctxt == suspendedContext] whileTrue: [
suspendedContext := suspendedContext step]]
onBehalfOf: self.
^suspendedContext
etc. ��Changes from a Qwaq image attached.
HTH