Thursday, October 20, 2016

Stepping in the new debugger

def StepCallback(event) :
 global BreakFlag
 prvev= BreakFlag
 BreakFlag = 1
 if pre < 0 : StepStatement()


The logic here is simpler.
When you click the step button, this procedure is called.  It first captures the BreakFlag, then sets it to step. This tells the call back trace to step ahead. But it will not run yet.

If the previous state was negative, then the call backs were not working,  we are not getting interrupted in the middle of a call to eval.

We have completely stepped through a logical statements and are at tab = 0, top level of the code.  Remember, we send only complete blocks to eval, I call those logical statements and they may be multi-line.

So, eval did not cause this interrupt if the flag is negative. Another logical statement must be sent down the eval pipe to restart, StepStatement does that.

If it was not negative, then step goes ahead and releases the interpreter to continue.  In this case, the user clicked step in he middle of a traceback.  The user, in both cases is in control, by clicking. Simple, but it gets me to 240 lines of code,   That is making this a mid-range effort,  and I am not set up for that.  The only thing left would be text centering,, then is stop.

Anyway, in the lab, at the computer center, it works.  I am using it a bit and fixing the odd bug, ready in a day or two.

No comments: