More on yesterday's experiments. The attached patch
(1) adds :debug as a valid state transition from the idle state
(2) adds SLIME-DEBUGGER-FUNCTION. This expects to be run in an environment in which the slime streams are available (e.g. from *slime-repl* or, I think, with C-c :) and returns a function that can be used for *debugger-hook* or *invoke-debugger-hook*
Note that (setf sb-debug::*invoke-debugger-hook* (slime-debugger-function)) doesn't actually work from *slime-repl* because the hook has already been bound so you're not setting the global value. Answers on a postcard.
(3) Changes eval-string to use *invoke-debugger-hook* instead of ordinary *debugger-hook* - because it's safe for BREAK, and also so it doesn't conflict with my existing (notionally portable) *debugger-hook* use in Araneida
If I culd figure out an appropriate place to put it, I'd want to make this a (with-debugging-hooked ...) macro, but I think that needs build order frobbing
The combined effect is that I can now use sldb when Araneida handlers cause errors. Setup recipe:
CL-USER> (asdf:operate 'asdf:load-op 'araneida) .... CL-USER> (load "/home/dan/src/telent/araneida/doc/example") T CL-USER> (araneida:start-listening my-araneida-example::*listener*) #<SB-IMPL::HANDLER INPUT on descriptor 5: #<FUNCTION "CLOSURE" {96F8645}>> CL-USER> (setf araneida::*break-on-handler-errors* t) T CL-USER> (defvar *foo* (swank::slime-debugger-function)) #<FUNCTION "CLOSURE" {96F9815}>
;;; meanwhile in *inferior-lisp* * (setf sb-debug::*invoke-debugger-hook* cl-user::*foo*)
I haven't applied this; it's more intended for discussion at present (particularly point (2)). Comments?
-dan