diff options
author | Andy Wingo <wingo@pobox.com> | 2010-10-06 21:19:08 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-10-06 21:19:08 +0200 |
commit | 439e032b0b04ddc96b0abcdcf73a4d9cf67316ee (patch) | |
tree | 4072a3cac401ab75e2d77de9b2474242ef574c5c /module/system/vm/traps.scm | |
parent | e8e4e7310c7c3964e4a6c19f154c3b341974eac7 (diff) | |
download | guile-439e032b0b04ddc96b0abcdcf73a4d9cf67316ee.tar.gz |
add ,step ,stepi ,next and ,nexti
* module/system/vm/traps.scm (trap-matching-instructions): New trap,
just installs a next hook and runs the handler when a predicate
succeeds.
* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): New
procedure, uses trap-matching-instructions with an appropriate
predicate to handle step, stepi, next, and nexti repl metacommands.
* module/system/repl/command.scm (step, step-instruction, next)
(next-instruction): New repl debugger commands.
Diffstat (limited to 'module/system/vm/traps.scm')
-rw-r--r-- | module/system/vm/traps.scm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/module/system/vm/traps.scm b/module/system/vm/traps.scm index 856492904..627e6c581 100644 --- a/module/system/vm/traps.scm +++ b/module/system/vm/traps.scm @@ -72,7 +72,8 @@ trap-in-dynamic-extent trap-calls-in-dynamic-extent trap-instructions-in-dynamic-extent - trap-calls-to-procedure)) + trap-calls-to-procedure + trap-matching-instructions)) (define-syntax arg-check (syntax-rules () @@ -662,3 +663,21 @@ (with-pending-finish-disablers (trap-at-procedure-call proc apply-hook #:vm vm)))) + +;; Trap when the source location changes. +;; +(define* (trap-matching-instructions frame-pred handler + #:key (vm (the-vm))) + (arg-check frame-pred procedure?) + (arg-check handler procedure?) + (let () + (define (next-hook frame) + (if (frame-pred frame) + (handler frame))) + + (new-enabled-trap + vm #f + (lambda (frame) + (add-hook! (vm-next-hook vm) next-hook)) + (lambda (frame) + (remove-hook! (vm-next-hook vm) next-hook))))) |