Debugging "1 ifTrue: [2]" (was Re: Debugger hang when step throught)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Debugging "1 ifTrue: [2]" (was Re: Debugger hang when step throught)

Ben Coman
On Tue, Feb 7, 2017 at 5:35 PM, Denis Kudriashov <[hidden email]> wrote:
> Also I found another funny issue. Try debugIt following expression:
>
> 1 ifTrue: [2].
>
> You will be wondering that debugger will not able to open.

To quickly get to the point to observe the cause, you can insert...
   Halt if: [interruptedProcess suspendedContext receiver == nil].
into DebugSession>>stepInto: just after the send of #step.

Then when you step into Context>>stepToSendOrReturn
step once over "context := self step"
and the second time step in until you get to
   Context>>jump:if:

which substitutes the following context 
      Context 
sender: self "=Undefined>>DoIt"
receiver: rcvr "=1"
method: newMethod "=Object>>#mustBeBoolean"
arguments: args "=#()"

such that in RubSmalltalkEditor>>debug:receiver:in:
the condition block
    debugSession stepIntoUntil: [:currentContext | 
currentContext method == aCompiledMethod ]
always fails, so in DebugSession>>stepIntoUntil:  the  #whileFalse:  never exits.

A possible fix (if a bit hacky) is... 
    debugSession stepIntoUntil: [:currentContext | 
(currentContext method == aCompiledMethod) 
                      or: [currentContext method selector==#mustBeBoolean] ].

cheers -ben