Next: Intro to Breakpoints, Up: Debugging Features
When an error is signalled, Guile remembers the execution context where the error occurred. By default, Guile then displays only the most immediate information about where and why the error occurred, for example:
(make-string (* 4 (+ 3 #\s)) #\space) -| standard input:2:19: In procedure + in expression (+ 3 #\s): standard input:2:19: Wrong type argument: #\s ABORT: (wrong-type-arg) Type "(backtrace)" to get more information or "(debug)" to enter the debugger.
However, as the message above says, you can obtain much more
information about the context of the error by typing
(backtrace)
or (debug)
.
(backtrace)
displays the Scheme call stack at the point where the
error occurred:
(backtrace) -| Backtrace: In standard input: 2: 0* [make-string ... 2: 1* [* 4 ... 2: 2* [+ 3 #\s] Type "(debug-enable 'backtrace)" if you would like a backtrace automatically if an error occurs in the future.
In a more complex scenario than this one, this can be extremely useful for understanding where and why the error occurred. For more on the format of the displayed backtrace, see the subsection below.
(debug)
takes you into Guile's interactive debugger, which
provides commands that allow you to
backtrace
command — see Display Backtrace)
up
, down
, frame
, position
, info args
and info frame
commands — see Frame Selection and
Frame Information)
evaluate
command — see Frame Evaluation).
Use of the interactive debugger, including these commands, is described in Interactive Debugger.