[gambit-list] stepper hook
Christian
christian at pflanze.mine.nu
Fri Jul 21 04:04:08 EDT 2006
I've now tried this:
(define (stepper-init)
(set! ##main-stepper
(vector
(make-vector 7
(lambda args
(##continuation-capture
(lambda (cont)
(set! conts (cons cont conts))))
(apply ##step-handler args)))
#f #f #f #f #f #f #f)))
(define (stepper-off)
;; reset to the original handler.
(set! ##main-stepper
(vector
(make-vector 7
##step-handler)
#f #f #f #f #f #f #f)))
(stepper-init)
If I call stepper-init immediately, before loading the code that I
want to step into, the issue with stepping being "turned off after a
few steps" has gone (I wonder why?).
The new handler catches continuations including the ##step-handler
call, to make sure I will be able to continue the stepping process,
as I hope.
Here's a sequence of commands I'm trying:
> (bruse exp-stepper)
> (use cj-transactionlog)
> (step)
> (transactionlog:open '("tmp/bla"))
*** STOPPED IN (stdin)@4.2
1> #||#,s;
| > transactionlog:open
| #<procedure #2 transactionlog:open>
*** STOPPED IN (stdin)@4.22
1> #||#,s;
| > '("tmp/bla")
| ("tmp/bla")
*** STOPPED IN (stdin)@4.1
1> #||#,s;
| > (transactionlog:open '("tmp/bla"))
*** STOPPED IN transactionlog:open, "cj-transactionlog.scm"@19.4
1> #||#,s;
| | > make-transactionlog
| | #<procedure #3 make-transactionlog>
*** STOPPED IN transactionlog:open, "cj-transactionlog.scm"@19.24
1> #||#,s;
| | > list-of-filepaths
| | ("tmp/bla")
*** STOPPED IN transactionlog:open, "cj-transactionlog.scm"@21.10
1> #||#,s;
| | > list-of-filepaths
| | ("tmp/bla")
*** STOPPED IN transactionlog:open, "cj-transactionlog.scm"@22.10
1> #||#,s;
| | > #f
| | #f
*** STOPPED IN transactionlog:open, "cj-transactionlog.scm"@23.10
1> ,c
| #<transactionlog #4 files: ("tmp/bla") curfile: ("tmp/bla") port:
#f parser...
#<transactionlog #4
files: ("tmp/bla")
curfile: ("tmp/bla")
port: #f
parser: #f>
> (stepper-off)
> conts
(#<continuation #5>
#<continuation #6>
#<continuation #7>
#<continuation #8>
#<continuation #9>
#<continuation #10>
#<continuation #11>
#<continuation #12>)
Now:
> (##repl-within #11 #f)
*** STOPPED IN (stdin)@36.2 ---> why is single-stepping now being
switched on again?
1> ,c <---- so that it continues until the sub repl is running.
1> , (s #f) <--- ok subr-repl is running, I'm entering (s #f) to
continue from cont #11
*** STOPPED IN (stdin)@4.22
1> (step) <-- just to make "really sure" single-stepping is on.
1> ,s <-- one step please.
| > '("tmp/bla") ----> but it evaluates everything until the end at
once. Why?
| ("tmp/bla")
#<transactionlog #18
files: ("tmp/bla")
curfile: ("tmp/bla")
port: #f
parser: #f>
>
I don't understand why the stepper is being switched back on above,
and then off again.
Why does this happen?
How does the interpreter use the current continuation itself? Does
taking a continuation work at all this way?
Thanks,
Christian.
More information about the Gambit-list
mailing list