我有以下程序:
调试.scm
(define (fn1 x)
(printf "fn1/ x=~a\n" x)
(fn2 x)
(printf "fn1/ end\n"))
(define (fn2 x)
(printf "fn2/ x=~a\n" x)
(fn3 x)
(printf "fn2/ end\n"))
(define (fn3 x)
(printf "fn3/ x=~a\n" x)
(cdr x)
(printf "fn3/ end\n"))
我在 REPL 中运行它。它按预期崩溃了。
然后我进入调试模式并检查了 raise continuation。
$ scheme
Chez Scheme Version 9.5.2
Copyright 1984-2019 Cisco Systems, Inc.
> (load "debugging.scm")
> (fn1 100)
fn1/ x=100
fn2/ x=100
fn3/ x=100
Exception in cdr: 100 is not a pair
Type (debug) to enter the debugger.
> (debug)
debug> ?
Type i to inspect the raise continuation (if available)
s to display the condition
c to inspect the condition
e or eof to exit the debugger, retaining error continuation
q to exit the debugger, discarding error continuation
debug> i
#<continuation in fn2> : ?
length(l) ........... display number of frame and closure variables
depth ............... display number of frames in continuation stack
ref(r) .............. inspect [named or nth] variable
set!(!) ............. set [named or nth] variable to value, if assignable
forward(f) .......... move to [nth] next frame
back(b) ............. move to [nth] previous frame
down(d) ............. inspect [nth] next frame
closure(cp) ......... inspect the frame's closure, if any
eval(e) ............. evaluate expression in context of current frame
show(s) ............. show frame with free variables
show-local(sl) ...... show frame without free variables
show-frames(sf) ..... show the next [n] frames
call ................ inspect the code for the pending call
code(c) ............. inspect the code for the pending procedure
file ................ switch to source file containing the pending call
?? .................. display more options
#<continuation in fn2> : sf
0: #<continuation in fn2>
1: #<continuation in fn1>
2: #<system continuation in new-cafe>
#<continuation in fn2> : e
_ ????
我的问题是,是否有可能在调试模式下获得当前的提升继续?
我想通过评估表达式来检查它,比如
(inspect/object current-raise-continuation)
谢谢。