mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-21 20:20:24 +02:00
Fix frame->stack-vector when no stack is active
* module/system/repl/debug.scm (frame->stack-vector): Handle the case where there is no active stack.
This commit is contained in:
parent
43a038f6e1
commit
737e62f4b5
1 changed files with 17 additions and 15 deletions
|
@ -25,9 +25,10 @@
|
||||||
#:use-module (system vm vm)
|
#:use-module (system vm vm)
|
||||||
#:use-module (system vm frame)
|
#:use-module (system vm frame)
|
||||||
#:use-module (system vm debug)
|
#:use-module (system vm debug)
|
||||||
|
#:use-module (ice-9 format)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 rdelim)
|
#:use-module (ice-9 rdelim)
|
||||||
#:use-module (ice-9 pretty-print)
|
#:use-module (ice-9 pretty-print)
|
||||||
#:use-module (ice-9 format)
|
|
||||||
#:use-module ((system vm inspect) #:select ((inspect . %inspect)))
|
#:use-module ((system vm inspect) #:select ((inspect . %inspect)))
|
||||||
#:use-module (system vm program)
|
#:use-module (system vm program)
|
||||||
#:export (<debug>
|
#:export (<debug>
|
||||||
|
@ -181,20 +182,21 @@
|
||||||
#()))) ; ? Can be the case for a tail-call to `throw' tho
|
#()))) ; ? Can be the case for a tail-call to `throw' tho
|
||||||
|
|
||||||
(define (frame->stack-vector frame)
|
(define (frame->stack-vector frame)
|
||||||
(let ((tag (and (pair? (fluid-ref %stacks))
|
(let ((stack (make-stack frame)))
|
||||||
(cdar (fluid-ref %stacks)))))
|
(match (fluid-ref %stacks)
|
||||||
|
(((stack-tag . prompt-tag) . _)
|
||||||
(narrow-stack->vector
|
(narrow-stack->vector
|
||||||
(make-stack frame)
|
stack
|
||||||
;; Take the stack from the given frame, cutting 0
|
;; Take the stack from the given frame, cutting 0 frames.
|
||||||
;; frames.
|
|
||||||
0
|
0
|
||||||
;; Narrow the end of the stack to the most recent
|
;; Narrow the end of the stack to the most recent start-stack.
|
||||||
;; start-stack.
|
prompt-tag
|
||||||
tag
|
;; And one more frame, because %start-stack invoking the
|
||||||
;; And one more frame, because %start-stack
|
;; start-stack thunk has its own frame too.
|
||||||
;; invoking the start-stack thunk has its own frame
|
0 (and prompt-tag 1)))
|
||||||
;; too.
|
(_
|
||||||
0 (and tag 1))))
|
;; Otherwise take the whole stack.
|
||||||
|
(stack->vector stack)))))
|
||||||
|
|
||||||
;; (define (debug)
|
;; (define (debug)
|
||||||
;; (run-debugger
|
;; (run-debugger
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue