[gambit-list] Untested patch: Debugger command to reprint error

Derek Peschel dpeschel at eskimo.com
Thu Mar 6 18:52:36 EST 2008


Since (IMO) the debugger should be able to describe everything it knows
about, I wrote a new command (for version 4.2.2) to reprint the last error.
Unfortunately I have no idea if I implemented it right.  A patch is
attached.

The test case
  foo
  bar
  ,d
  ,r
implies that there's only one error shared by all REPL levels (which makes
the levels less useful than they might be).

Typing the "foo bar" on the same line also shows how prompts and output
can be mixed.  The Emacs interface doesn't recognize the 1> prompt before
the second error message, so it only highlights the first error even though
the interpreter has forgotten the first error.

Thanks for any comments.

-- Derek
-------------- next part --------------
--- _repl.scm.orig	Sun Feb 10 22:59:56 2008
+++ _repl.scm	Sun Mar  2 02:50:04 2008
@@ -880,6 +880,7 @@
 ,qt           : Terminate the current thread
 ,t            : Jump to toplevel REPL
 ,d            : Jump to enclosing REPL
+,r            : Display reason for entering this REPL
 ,c and ,(c X) : Continue the computation with stepping off
 ,s and ,(s X) : Continue the computation with stepping on (step)
 ,l and ,(l X) : Continue the computation with stepping on (leap)
@@ -2351,10 +2352,10 @@
                       (continue))
                      ((##eq? cmd 'e)
                       (##repl-channel-display-multiline-message
-                       (lambda (output-port)
-                         (##cmd-e (first-interesting
-                                   (macro-repl-context-cont repl-context))
-                                  output-port)))
+                      (lambda (output-port)
+                        (##cmd-e (first-interesting
+                                  (macro-repl-context-cont repl-context))
+                                 output-port)))
                       (continue))
                      ((##eq? cmd 't)
                       (cmd-t))
@@ -2365,6 +2366,14 @@
                       (quit))
                      ((##eq? cmd 'qt)
                       (quit-thread))
+                     ((##eq? cmd 'r)
+                      (if write-reason
+                        (##repl-channel-display-multiline-message
+                        (lambda (output-port)
+                          (write-reason (first-interesting
+                                         (macro-repl-context-cont repl-context))
+                                        output-port))))
+                      (continue))
                      ((and (##fixnum? cmd)
                            (##not (##fixnum.< cmd 0)))
                       (goto-depth cmd))


More information about the Gambit-list mailing list