Next: Values From Inferior In Guile, Previous: GDB Scheme Data Types, Up: Guile API [Contents][Index]
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
the guile print-stack
parameter.
The guile print-stack
parameter has three settings:
none
Nothing is printed.
message
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.
full
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 wrong-type-arg
and out-of-range
.
User interrupt (via C-c or by typing q at a pagination
prompt) is translated to a Guile signal
exception with value
SIGINT
.
GDB Guile procedures can also throw these exceptions:
gdb:error
This exception is a catch-all for errors generated from within GDB.
gdb:invalid-object
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.
gdb:memory-error
This exception is thrown when an operation tried to access invalid memory in the inferior.
gdb:pp-type-error
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)
module.
Return a <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).
Return #t
if object is a <gdb:exception>
object.
Otherwise return #f
.
Return the args field of a <gdb:exception>
object.
Return the args field of a <gdb:exception>
object.
Next: Values From Inferior In Guile, Previous: GDB Scheme Data Types, Up: Guile API [Contents][Index]