Next: Procedural Breakpoints, Previous: Breakpoints Overview, Up: Intro to Breakpoints
A source breakpoint is a breakpoint that triggers whenever program
execution hits a particular source location. A source breakpoint can be
conveniently set simply by evaluating code that has ## inserted
into it at the position where you want the breakpoint to be.
For example, to set a breakpoint immediately before evaluation of
(= n 0) in the following procedure definition, evaluate:
(define (fact1 n)
(if ##(= n 0)
1
(* n (fact1 (- n 1)))))
-|
Set breakpoint 1: standard input:4:9: (= n 0)
Note the message confirming that you have set a breakpoint. If you don't see this, something isn't working.
## is provided by the (ice-9 debugger breakpoints source) module,
so you must use this module before trying to set breakpoints in this
way:
(use-modules (ice-9 debugger breakpoints source))
You may like to add this to your .guile file.
The default behaviour for source breakpoints is debug-here
(see Breakpoint Behaviours), which means to enter the command line
debugger when the breakpoint is hit. So, if you now use fact1,
that is what happens.
guile> (fact1 3)
Hit breakpoint 1: standard input:4:9: (= n 0)
Frame 3 at standard input:4:9
(= n 0)
debug>