From 9484e9b949e01f638ee4a0bd8a15f44e61e6ee69 Mon Sep 17 00:00:00 2001 From: Peter Feigl Date: Thu, 3 May 2012 09:45:45 +0200 Subject: [PATCH] Fix basic debugging problems. * Debugging There are numerous problems, including no replies sent to messages and incorrect replies. - Added condition/report-string to the abort message. - Added a DYNAMIC-WIND in the condition handler in the message handler for emacs-rex to ensure that the :abort message is always written, even when a restart is called. - Added a global (fluid) binding *index* that is used to send the correct message index in the :debug message. There are many problems remaining, to be tackled in a later commit. --- src/runtime/swank.scm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/runtime/swank.scm b/src/runtime/swank.scm index fa932d9b4..b5e0f0f8f 100644 --- a/src/runtime/swank.scm +++ b/src/runtime/swank.scm @@ -201,16 +201,22 @@ USA. (lambda (k) (bind-condition-handler (list condition-type:serious-condition) (lambda (condition) - (invoke-sldb socket (+ level 1) condition) - (write-message `(:return (:abort) ,id) socket) - (k unspecific)) + (dynamic-wind + (lambda () + #f) + (lambda () + (invoke-sldb socket (+ level 1) condition)) + (lambda () + (write-message `(:return (:abort ,(condition/report-string condition)) ,id) socket)))) (lambda () - (write-message `(:return (:ok ,(emacs-rex socket sexp pstring)) + (write-message `(:return (:ok ,(emacs-rex socket sexp pstring id)) ,id) socket))))))) +(define *index*) -(define (emacs-rex socket sexp pstring) - (fluid-let ((*buffer-pstring* pstring)) +(define (emacs-rex socket sexp pstring id) + (fluid-let ((*buffer-pstring* pstring) + (*index* id)) (eval (cons* (car sexp) socket (map quote-special (cdr sexp))) swank-env))) @@ -600,7 +606,7 @@ swank:xref (sldb-restarts rs) (sldb-backtrace c start end) ;;'((0 "dummy frame")) - '()))) + (list *index*)))) (define (sldb-restarts restarts) (map (lambda (r) @@ -623,6 +629,7 @@ swank:xref (define (swank:invoke-nth-restart-for-emacs socket sldb-level n) socket sldb-level + (write-message `(:return (:abort "NIL") ,*index*) socket) (invoke-restart (list-ref (sldb-state.restarts *sldb-state*) n))) (define (swank:debugger-info-for-emacs socket from to) -- 2.25.1