Luke Gorrie luke@bluetail.com writes:
Oops.. now I see why you split activate and initialize.
Next incarnation. Pushes the "do we need to reinit *sldb*?" logic from Emacs into Lisp:
(defvar *sldb-level-in-emacs* nil)
(defun sldb-loop (level) (flet ((activate-emacs () (send-to-emacs (list* :debug *sldb-level* (debugger-info-for-emacs 0 *sldb-initial-frames*))) (setq *sldb-level-in-emacs* level))) (activate-emacs) (unwind-protect (loop (catch 'sldb-loop-catcher (with-simple-restart (abort "Return to sldb level ~D." level) (unless (eql level *sldb-level-in-emacs*) (activate-emacs)) (handler-bind ((sldb-condition #'handle-sldb-condition)) (read-from-emacs))))) (send-to-emacs `(:debug-return ,level)))))
I'll continue trying to beat it into submission, and try to properly handle e.g. user killing *sldb* at an inconvenient time, tomorrow.