diff options
author | Andy Wingo <wingo@pobox.com> | 2010-10-05 21:49:13 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-10-05 21:49:13 +0200 |
commit | 586aff5a27fc880b8f80e20352e3bad41c75616c (patch) | |
tree | 8f41d7543e1090410cb6e5d5a4031e5073aa23d1 /module | |
parent | 2c04cf390b832ec28fac33df5c4a77e00bcd31eb (diff) | |
download | guile-586aff5a27fc880b8f80e20352e3bad41c75616c.tar.gz |
(system repl debug): add frame->stack-vector
* module/system/repl/debug.scm (frame->stack-vector): New public
function.
Diffstat (limited to 'module')
-rw-r--r-- | module/system/repl/debug.scm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/module/system/repl/debug.scm b/module/system/repl/debug.scm index 0e491b5db..da42a37fe 100644 --- a/module/system/repl/debug.scm +++ b/module/system/repl/debug.scm @@ -32,7 +32,8 @@ #:export (<debug> make-debug debug? debug-frames debug-index debug-error-message print-registers print-locals print-frame print-frames frame->module - stack->vector narrow-stack->vector)) + stack->vector narrow-stack->vector + frame->stack-vector)) ;; TODO: ;; @@ -181,6 +182,21 @@ (stack->vector narrowed) #()))) ; ? Can be the case for a tail-call to `throw' tho +(define (frame->stack-vector frame) + (let ((tag (and (pair? (fluid-ref %stacks)) + (cdar (fluid-ref %stacks))))) + (narrow-stack->vector + (make-stack frame) + ;; Take the stack from the given frame, cutting 0 + ;; frames. + 0 + ;; Narrow the end of the stack to the most recent + ;; start-stack. + tag + ;; And one more frame, because %start-stack + ;; invoking the start-stack thunk has its own frame + ;; too. + 0 (and tag 1)))) ;; (define (debug) ;; (run-debugger |