When executing the
guile command, Guile exceptions
uncaught within the Guile code are translated to calls to the
GDB error-reporting mechanism. If the command that called
guile does not handle the error, GDB will
terminate it and report the error according to the setting of
guile print-stack parameter.
guile print-stack parameter has three settings:
Nothing is printed.
An error message is printed containing the Guile exception name, the associated value, and the Guile call stack backtrace at the point where the exception was raised. Example:
(gdb) guile (display foo) ERROR: In procedure memoize-variable-access!: ERROR: Unbound variable: foo Error while executing Scheme code.
In addition to an error message a full backtrace is printed.
(gdb) set guile print-stack full (gdb) guile (display foo) Guile Backtrace: In ice-9/boot-9.scm: 157: 10 [catch #t #<catch-closure 2c76e20> ...] In unknown file: ?: 9 [apply-smob/1 #<catch-closure 2c76e20>] In ice-9/boot-9.scm: 157: 8 [catch #t #<catch-closure 2c76d20> ...] In unknown file: ?: 7 [apply-smob/1 #<catch-closure 2c76d20>] ?: 6 [call-with-input-string "(display foo)" ...] In ice-9/boot-9.scm: 2320: 5 [save-module-excursion #<procedure 2c2dc30 ... ()>] In ice-9/eval-string.scm: 44: 4 [read-and-eval #<input: string 27cb410> #:lang ...] 37: 3 [lp (display foo)] In ice-9/eval.scm: 387: 2 [eval # ()] 393: 1 [eval #<memoized foo> ()] In unknown file: ?: 0 [memoize-variable-access! #<memoized foo> ...] ERROR: In procedure memoize-variable-access!: ERROR: Unbound variable: foo Error while executing Scheme code.
GDB errors that happen in GDB commands invoked by Guile code are converted to Guile exceptions. The type of the Guile exception depends on the error.
Guile procedures provided by GDB can throw the standard
Guile exceptions like
User interrupt (via C-c or by typing q at a pagination
prompt) is translated to a Guile
signal exception with value
GDB Guile procedures can also throw these exceptions:
This exception is a catch-all for errors generated from within GDB.
This exception is thrown when accessing Guile objects that wrap underlying
GDB objects have become invalid. For example, a
<gdb:breakpoint> object becomes invalid if the user deletes it
from the command line. The object still exists in Guile, but the
object it represents is gone. Further operations on this breakpoint
will throw this exception.
This exception is thrown when an operation tried to access invalid memory in the inferior.
This exception is thrown when a Guile pretty-printer passes a bad object to GDB.
The following exception-related procedures are provided by the
<gdb:exception> object given by its key and
args, which are the standard Guile parameters of an exception.
See the Guile documentation for more information (see Exceptions in GNU Guile Reference Manual).
#t if object is a
Return the args field of a
Return the args field of a