debug has for-trap? field
authorAndy Wingo <wingo@pobox.com>
Tue, 12 Oct 2010 11:09:48 +0000 (13:09 +0200)
committerAndy Wingo <wingo@pobox.com>
Tue, 12 Oct 2010 11:09:48 +0000 (13:09 +0200)
* module/system/repl/debug.scm (<debug>): New field, `for-trap?'. True
  if the stack is for a trap, and thus the top frame should use
  frame-next-source instead of frame-source.

* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (repl-next-resumer):
* module/system/repl/error-handling.scm (call-with-error-handling):
  Update callers.

module/system/repl/command.scm
module/system/repl/debug.scm
module/system/repl/error-handling.scm

index ef2c5a6..0ec31e4 100644 (file)
@@ -617,7 +617,7 @@ Note that the given source location must be inside a procedure."
                  (format #t "Return values:~%")
                  (for-each (lambda (x) (repl-print repl x)) vals))))
          ((module-ref (resolve-interface '(system repl repl)) 'start-repl)
-          #:debug (make-debug stack 0 msg))))))
+          #:debug (make-debug stack 0 msg #t))))))
 
 (define-stack-command (finish repl)
   "finish
@@ -641,7 +641,7 @@ Resume execution, breaking when the current frame finishes."
                        (k (frame->stack-vector frame)))))))
        (format #t "~a~%" msg)
        ((module-ref (resolve-interface '(system repl repl)) 'start-repl)
-        #:debug (make-debug stack 0 msg)))))
+        #:debug (make-debug stack 0 msg #t)))))
 
 (define-stack-command (step repl)
   "step
index e3beee1..61ecf84 100644 (file)
@@ -30,7 +30,8 @@
   #:use-module ((system vm inspect) #:select ((inspect . %inspect)))
   #:use-module (system vm program)
   #:export (<debug>
-            make-debug debug? debug-frames debug-index debug-error-message
+            make-debug debug?
+            debug-frames debug-index debug-error-message debug-for-trap?
             print-registers print-locals print-frame print-frames frame->module
             stack->vector narrow-stack->vector
             frame->stack-vector))
@@ -53,7 +54,7 @@
 ;;; accessors, and provides some helper functions.
 ;;;
 
-(define-record <debug> frames index error-message)
+(define-record <debug> frames index error-message for-trap?)
 
 \f
 
index 58317a8..737eadf 100644 (file)
@@ -76,7 +76,7 @@
              (error-msg (if trap-idx
                             (format #f "Trap ~d: ~a" trap-idx trap-name)
                             trap-name))
-             (debug (make-debug stack 0 error-msg)))
+             (debug (make-debug stack 0 error-msg #t)))
         (with-saved-ports
          (lambda ()
            (if trap-idx
                           ;; the start-stack thunk has its own frame too.
                           0 (and tag 1)))
                   (error-msg (error-string stack key args))
-                  (debug (make-debug stack 0 error-msg)))
+                  (debug (make-debug stack 0 error-msg #f)))
              (with-saved-ports
               (lambda ()
                 (format #t "~a~%" error-msg)