Debugger breakWhen

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

Debugger breakWhen

John Brant
I was trying to add a new step mode to the debugger. I want to be able
to specify the packages that step should ignore and which packages step
should step into. For example, if I'm debugging my code, I don't really
want to see the code for OrderedCollection>>do:, but I would like to see
  my do: block code.

The breakWhen block appeared like it would do the trick. I created a new
step method and set the breakWhen block. Most things work, but the first
time you step into a method, it always breaks even if your breakWhen
block returns false. The problem appears to be that #onStep: method
sends the #breakFrame: message if the method isn't a debug method. The
#breakFrame: method then resets the breakWhen block so it immediately
breaks. I commented out the #breakWhen: message send in #breakFrame:,
and my step worked, and I didn't notice any other problems. Should the
#breakFrame: method be overwriting the breakWhen block?

Here's my step method:
----------------
Debugger>>stepInPackage
        | frame lastMethod lastIsValid |
        self debugState: 'Step in Package'.
        lastMethod := nil.
        lastIsValid := true.
        self
                breakWhen:
                        [:iFrame |
                        | method package |
                        method := iFrame method.
                        method == lastMethod
                                ifTrue: [lastIsValid]
                                ifFalse:
                                        [lastMethod := method.
                                        package := method owningPackage.
                                        lastIsValid := (package notNil and: ['*Dolphin*' match: package
name]) not]].
        frame := self frame.
        self makeDebugFrame: frame.
        self makeDebugFrame: frame sender.
        self beRunning.
        suspendingList class == Semaphore
                ifTrue: [self resume]
                ifFalse:
                        [suspendingList := nil.
                        process step]
----------------
Currently, it is hardcoded to ignore packages with "Dolphin" in their name.


John Brant


Reply | Threaded
Open this post in threaded view
|

Re: Debugger breakWhen

Blair McGlashan-3
"John Brant" <[hidden email]> wrote in message
news:gXtze.134215$x96.62867@attbi_s72...

>I was trying to add a new step mode to the debugger. I want to be able to
>specify the packages that step should ignore and which packages step should
>step into. For example, if I'm debugging my code, I don't really want to
>see the code for OrderedCollection>>do:, but I would like to see my do:
>block code.
>
> The breakWhen block appeared like it would do the trick. I created a new
> step method and set the breakWhen block. Most things work, but the first
> time you step into a method, it always breaks even if your breakWhen block
> returns false. The problem appears to be that #onStep: method sends the
> #breakFrame: message if the method isn't a debug method. The #breakFrame:
> method then resets the breakWhen block so it immediately breaks. I
> commented out the #breakWhen: message send in #breakFrame:, and my step
> worked, and I didn't notice any other problems. Should the #breakFrame:
> method be overwriting the breakWhen block?

John, I agree with you that there is something wrong here, however at a
glance I think your modification may lead to problems with the stepping in
some circumstances. I'm afraid I'll need to think about this a bit and get
back to you.

Regards

Blair