Manuscript (Case [Issue]22085) Debugging - Infinite debugger

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

Manuscript (Case [Issue]22085) Debugging - Infinite debugger

Pharo Issue Tracker
Manuscript Notification
avatar
Guillermo Polito edited Case 22085: Infinite debugger:
Bug in Project:  Debugging: 1. Pharo Image  •  You are subscribed to this case
Somehow changing this method like this:

runUntilErrorOrReturnFrom: aSender
"ASSUMES aSender is a sender of self. Execute self's stack until aSender returns or an unhandled exception is raised. Return a pair containing the new top context and a possibly nil exception. The exception is not nil if it was raised before aSender returned and it was not handled. The exception is returned rather than openning the debugger, giving the caller the choice of how to handle it."
"Self is run by jumping directly to it (the active process abandons thisContext and executes self). However, before jumping to self we insert an ensure block under aSender that jumps back to thisContext when evaluated. We also insert an exception handler under aSender that jumps back to thisContext when an unhandled exception is raised. In either case, the inserted ensure and exception handler are removed once control jumps back to thisContext."

| error context here topContext |
here := thisContext.
"Insert ensure and exception handler contexts under aSender"
error := nil.
context := aSender insertSender: (Context
contextOn: Exception do: [:ex |
error ifNil: [
"this is ugly but it fixes the side-effects of not sending an Unhandled error on Halt"
error := (ex isKindOf: UnhandledError) ifTrue: [ ex exception ] ifFalse: [ ex ].
topContext := thisContext.
ex resumeUnchecked: here jump ]
ifNotNil: [ ex pass ]]).
context := context insertSender: (Context
contextEnsure: [error ifNil: [
topContext := thisContext.
here jump]
]).
self jump. "Control jumps to self"

"Control resumes here once above ensure block or exception handler is executed"
^ error ifNil: [
"No error was raised, remove ensure context by stepping until popped"
[(context isDead)or: [ topContext isNil ]] whileFalse: [topContext := topContext stepToCallee].
{topContext. nil}

] ifNotNil: [
"Error was raised, remove inserted above contexts then return signaler context"
aSender terminateTo: context sender. "remove above ensure and handler contexts"
{topContext. error}
].

Behaves better. It looks like a problem with how we manage UnhandledError exceptions.
Priority Priority: 5 – Fix If Time Status Status: Work Needed
Assigned To Assigned to: Guillermo Polito Milestone Milestone: Later

Go to Case
No longer need updates? Unsubscribe from this case.

Don't want Manuscript notifications anymore? Update your preferences.

Manuscript

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
https://lists.gforge.inria.fr/mailman/listinfo/pharo-bugtracker