Next: Setting Breakpoints, Previous: Source Breakpoints, Up: Intro to Breakpoints
A procedural breakpoint is a breakpoint that triggers whenever Guile is
about to apply a specified procedure to its (already evaluated)
arguments. To set a procedural breakpoint, call break!
with the
target procedure as a single argument. For example:
(define (fact1 n) (if (= n 0) 1 (* n (fact1 (- n 1))))) (break! fact1) -| Set breakpoint 1: [fact1] => #<<procedure-breakpoint> 808b0b0>
Alternatives to break!
are trace!
and
trace-subtree!
. The difference is that these three calls create
a breakpoint in the same place but with three different behaviours,
respectively debug-here
, trace-here
and
trace-subtree
. Breakpoint behaviours are documented fully later
(see Breakpoint Behaviours), but to give a quick taste, here's an
example of running code that includes a procedural breakpoint with the
trace-here
behaviour.
(trace! fact1) -| Set breakpoint 1: [fact1] => #<<procedure-breakpoint> 808b0b0> (fact1 4) -| | [fact1 4] | | [fact1 3] | | | [fact1 2] | | | | [fact1 1] | | | | | [fact1 0] | | | | | 1 | | | | 2 | | | 6 | | 24 | 24 => 24
To set and use procedural breakpoints, you will need to use the
(ice-9 debugger breakpoints procedural)
module:
(use-modules (ice-9 debugger breakpoints procedural))
You may like to add this to your .guile file.