summaryrefslogtreecommitdiff
path: root/module/system/vm/trap-state.scm
Commit message (Collapse)AuthorAgeFilesLines
* No more VM objects visible to SchemeAndy Wingo2013-11-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/vm.h: * libguile/vm.c (scm_the_vm): Don't expose to Scheme. (scm_vm_p): Remove, as it is not needed. * module/system/vm/vm.scm: Remove the-vm and vm? exports. * doc/ref/api-coverage.texi (Code Coverage): * test-suite/tests/coverage.test: * module/system/vm/coverage.scm (with-code-coverage): Don't take a VM argument. Adapt documentation and tests. * module/ice-9/command-line.scm: Remove the-vm autoload. * module/system/vm/trace.scm (trace-calls-to-procedure): (trace-calls-in-procedure): (trace-instructions-in-procedure): (call-with-trace): Remove #:vm kwarg, and adapt to trap changes. * module/system/vm/trap-state.scm (the-trap-state): Rework to use a parameter underneath instead of a weak key on (the-vm). * module/system/vm/traps.scm (new-disabled-trap): (new-enabled-trap): Remove vm argument. (trap-at-procedure-call): (trap-in-procedure): (trap-instructions-in-procedure): (trap-at-procedure-ip-in-range): (trap-at-source-location): (trap-frame-finish): (trap-in-dynamic-extent): (trap-calls-in-dynamic-extent): (trap-instructions-in-dynamic-extent): (trap-calls-to-procedure): (trap-matching-instructions): Remove vm keyword arguments. * test-suite/tests/control.test ("unwind"): Adapt test. * test-suite/tests/eval.test (test-suite): Remove the-vm import.
* VM accessors take VM as implicit argument, not explicit argumentAndy Wingo2013-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * libguile/vm.h: * libguile/vm.c: (scm_vm_apply_hook, scm_vm_push_continuation_hook, scm_vm_pop_continuation_hook, scm_vm_abort_continuation_hook, scm_vm_restore_continuation_hook, scm_vm_next_hook, scm_vm_trace_level, scm_set_vm_trace_level_x, scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): The VM argument is now implicit: the VM for the current thread. * doc/ref/api-debug.texi (VM Hooks): Try to adapt. * module/ice-9/command-line.scm: * module/statprof.scm: * module/system/vm/coverage.scm: * module/system/vm/trace.scm: * module/system/vm/trap-state.scm: * module/system/vm/traps.scm: * test-suite/tests/control.test: * test-suite/tests/eval.test: Adapt users that set hooks or ensure that we have a debug engine.
* Program sources are always pre-retire nowAndy Wingo2013-11-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | * module/system/repl/debug.scm (<debug>): Remove for-trap?. Backtraces with RTL will always happen pre-retire on the top frame, source info is pre-retire, and continuations will always have a source-marked receive or receive-values or whatever with the right source marking, so we can remove this complication. (print-frame): Use frame-source. (print-frames): Remove for-trap? kw. * module/system/repl/command.scm (define-stack-command, backtrace) (up, down, frame): Remove for-trap? introduced local, and its uses. (repl-pop-continuation-resumer): Adapt to make-debug change. * module/system/repl/error-handling.scm (call-with-error-handling): Adapt to make-debug change. * module/system/vm/frame.scm (frame-next-source): Remove. RTL sources are pre-retire. * module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Adapt to use frame-source. Still some work to do here.
* stepping traps use frame-next-source, not frame-sourceAndy Wingo2010-10-081-2/+2
| | | | | * module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Use frame-next-source in stepping traps.
* document trap statesAndy Wingo2010-10-071-1/+2
| | | | | | * module/system/vm/trap-state.scm: Export add-trap!. * doc/ref/api-debug.texi (Trap States): Document.
* add ,step ,stepi ,next and ,nextiAndy Wingo2010-10-061-1/+42
| | | | | | | | | | | | | * 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.
* cleanups to ,finishAndy Wingo2010-10-061-3/+4
| | | | | | | | | | | | * module/system/repl/command.scm (repl-pop-continuation-resumer): Factor out of finish. (finish): Adapt. * module/system/vm/trap-state.scm (add-ephemeral-trap-at-frame-finish!): Rename to add "ephemeral" to the name. * module/system/vm/traps.scm (trap-calls-to-procedure): Remove unused #:width kwarg.
* (system vm trap-state): add-trap-at-frame-finish!Andy Wingo2010-10-051-2/+33
| | | | | | | | | | | | * module/system/vm/traps.scm: Fix a comment. * module/system/vm/trap-state.scm (<trap-state>): Add next-ephemeral-idx slot. (wrapper-at-index): Use eqv? instead of = to avoid type errors in user inputs. (next-ephemeral-index!, ephemeral-handler-for-index): New functions, allocate ephemeral trap ids for functions to be called only once. (add-trap-at-frame-finish!): New export, traps when a frame finishes.
* fix embarrassing error preventing ,del from workingAndy Wingo2010-10-051-1/+2
| | | | | * module/system/vm/trap-state.scm (remove-trap-wrapper!): Oops, fix newbie error regarding delq and mutation.
* source breakpoints accept user line numbersAndy Wingo2010-10-011-3/+3
| | | | | | | | * module/system/vm/trap-state.scm (add-trap-at-source-location!): * module/system/vm/traps.scm (trap-at-source-location): Rename "line" argument to "user-line", indicating that the line is one-based instead of zero-based. Decrement the line before handing off to source-closures-or-procedures and source->ip-range.
* add ,break-at-sourceAndy Wingo2010-09-231-1/+13
| | | | | | | | * module/system/vm/trap-state.scm (add-trap-at-source-location!): New proc. * module/system/repl/command.scm (break-at-source): New repl meta-command. Doesn't work as well as it could now because it doesn't know about nested functions, but that's coming.
* another trap printing tweakAndy Wingo2010-09-231-2/+2
| | | | | * module/system/vm/trap-state.scm (add-trap-at-procedure-call!): (add-trace-at-procedure-call!): Breakpoint / tracepoint name tweaks.
* list-traps just returns trap identifiers, not namesAndy Wingo2010-09-231-4/+1
| | | | | | | * module/system/vm/trap-state.scm (list-traps): Just return the integers identifying the traps; people can use trap-name to get the names. * module/system/repl/command.scm (traps): Adapt.
* trace printing tweakAndy Wingo2010-09-231-1/+1
| | | | | * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Tweak to the #:prefix string.
* add trap-name procedureAndy Wingo2010-09-231-0/+5
| | | | * module/system/vm/trap-state.scm (trap-name): New proc.
* tracepoints print their trap numberAndy Wingo2010-09-231-1/+3
| | | | | | | | | | * module/system/vm/trace.scm (print-application, print-return): Add a prefix before the printout. (trace-calls-to-procedure, trace-calls-in-procedure): Add prefix keyword args. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Give a useful prefix for tracepoint printouts.
* add repl ,tracepoint commandAndy Wingo2010-09-231-1/+13
| | | | | | | | | | | | | | * module/system/vm/trace.scm (print-return, print-application) (frame-return-values): Factored out of other things. (trace-calls-to-procedure): New proc, installs a trap tracing only calls to the given proc. (trace-calls-in-procedure): Refactor a bit. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): New proc. * module/system/repl/command.scm (tracepoint): New command, installs a tracepoint on a procedure.
* avoid traps in repl except when evaluating the expressionAndy Wingo2010-09-231-2/+5
| | | | | | | | | | | | * module/system/vm/trap-state.scm (with-default-trap-handler): Don't enable traps if we are setting a handler of #f. * module/system/repl/error-handling.scm (call-with-error-handling): Add #:trap-handler arg. * module/system/repl/repl.scm (run-repl): Only have traps enabled while running the thunk. Otherwise we trace on procedures called as part of the repl.
* tracing in terms of trapsAndy Wingo2010-09-231-0/+6
| | | | | | | | | | | | | | * module/system/vm/traps.scm (trap-frame-finish) (trap-in-dynamic-extent, trap-calls-in-dynamic-extent) (trap-instructions-in-dynamic-extent): New traps, for implementing tracing, and the `finish' command. * module/system/vm/trace.scm (trace-calls-in-procedure) (trace-instructions-in-procedure): New tracing traps. (vm-trace): Reimplement in terms of the new traps. * module/system/vm/trap-state.scm (add-trap!): New helper; not used in this commit, though.
* breakpoints from recursive prompts workAndy Wingo2010-09-211-4/+19
| | | | | | | | | | | | | | | | * module/system/vm/traps.scm (new-disabled-trap): Don't manipulate the VM trace level in the enable and disable handlers. Unfortunately, this makes traps not work unless you enable hooks, but given that vm_dispatch_hook has to set trace-level to 0, there needs to be an object with a broader view of what traps are enabled. That object is the hook state. * module/system/vm/trap-state.scm (trap-state->trace-level): New procedure. (with-default-trap-handler): Add an optional trap-state argument. Now makes sure that the vm-trace-level is set appropriately during the execution of the thunk, allowing for breakpoints from recursive prompts.
* default-trap-handler bugfixAndy Wingo2010-09-191-3/+4
| | | | * module/system/vm/trap-state.scm (default-trap-handler): Fix thinko.
* implement breakpoints in the replAndy Wingo2010-09-191-0/+174
* module/system/vm/trap-state.scm: New file, tracks a VM-specific set of traps. * module/Makefile.am: Add trap-state.scm. * module/system/repl/error-handling.scm: While in a with-error-handling block, bind a default trap handler that invokes a recursive prompt. * module/system/repl/command.scm: Add a `break' repl meta-command.