Mark Evenson writes:
On 9/17/09 10:56 AM, Tobias C. Rittweiler wrote:
C-c C-c is SWANK-COMPILE-STRING in swank-abcl.lisp.
If you follow the control flow, you'll see that in SLDB-LOOP (we come here through *DEBUGGER-HOOK*) in swank.lisp,
__the UNWINDED-PROTECT's protected form is *never* executed and it goes straight to the cleanup forms.__
Hmmm, I don't come up with the same analysis of the control flow. I don't see the code going through SLDB-LOOP at all, but rather bombing out in swank-abcl.lisp's implementation of SWANK-COMPILE-STRING at line 396 because in ABCL the comma not inside a backquote is a READER-ERROR which is not a subtype of the WARNING referenced in the enclosing HANDLER-BIND. The actual error is coming from READ-FROM-STRING:
One can reproduce the error from the SLIME REPL by evaluating
(SWANK-BACKEND:SWANK-COMPILE-STRING "(defun test (x) ,bar)" :BUFFER "*slime-scratch*" :POSITION 1 :FILENAME NIL :POLICY NIL)
If I bind a handler for ERROR in the enclosing HANDLER-BIND, I do trap the error.
Tobias: are you relying on visual inspection of the problem here, or are you getting a backtrace somehow? I didn't understand your comment "(we come here through *DEBUGGER-HOOK*)".
*DEBUGGER-HOOK* is set to SWANK-DEBUGGER-HOOK which calls DEBUG-IN-EMACS which calls SLDB-LOOP.
READ-FROM-STRING calls ERROR which calls INVOKE-DEBUGGER which calls the function in *DEBUGGER-HOOK*
Does that make more sense?
Just insert some FORMAT calls to SLDB-LOOP, in particular one before the UWP, and one as the first form of the protected form.
SBCL writes the string to a temporary file, then compiles that file. Since the ABCL code for compiling a file works ok, I would maybe pursue that route.
Yes, that's the way it should be implemented for other reasons: COMPILE does not process source as file compiler, think of EVAL-WHEN.
See my comment at http://trac.common-lisp.net/armedbear/ticket/56 for the proper way of how to implement SWANK-COMPILE-STRING.
I'll make it go the route over a temp file, but the UWP issue should be resolved first otherwise I'd remove the way to reproduce this issue.
-T.