summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-06-18 13:10:33 +0200
committerAndy Wingo <wingo@pobox.com>2010-06-18 13:10:33 +0200
commit5827e220abac373645e637ece99a9c6550c96bf0 (patch)
treea2933ddbb8fb0b480afe7d260bce86c7d592ae23
parent48201a94eb6892b3d55b3de10c53fc9b34cf689c (diff)
downloadguile-5827e220abac373645e637ece99a9c6550c96bf0.tar.gz
`(debug)' debugs the current stack.
* module/system/vm/debug.scm (debug): Change to debug the current stack instead of the last stack.
-rw-r--r--module/system/vm/debug.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
index 815135647..dfc7140d8 100644
--- a/module/system/vm/debug.scm
+++ b/module/system/vm/debug.scm
@@ -446,10 +446,14 @@ With an argument, select a frame by index, then show it."
v))
(define (debug)
- (let ((stack (fluid-ref the-last-stack)))
- (if stack
- (run-debugger (stack->vector stack))
- (display "Nothing to debug.\n" (debug-output-port)))))
+ (run-debugger
+ (narrow-stack->vector
+ (make-stack #t)
+ ;; Narrow the `make-stack' frame and the `debug' frame
+ 2
+ ;; Narrow the end of the stack to the most recent start-stack.
+ (and (pair? (fluid-ref %stacks))
+ (cdar (fluid-ref %stacks))))))
(define (narrow-stack->vector stack . args)
(stack->vector (apply make-stack (stack-ref stack 0) args)))