Next: Lazy Strings In Guile, Previous: Symbol Tables In Guile, Up: Guile API [Contents][Index]
Breakpoints in Guile are represented by objects of type
<gdb:breakpoint>
. New breakpoints can be created with the
make-breakpoint
Guile function, and then added to GDB with the
register-breakpoint!
Guile function.
This two-step approach is taken to separate out the side-effect of adding
the breakpoint to GDB from make-breakpoint
.
Support is also provided to view and manipulate breakpoints created outside of Guile.
The following breakpoint-related procedures are provided by the
(gdb)
module:
Create a new breakpoint at location
, a string naming the
location of the breakpoint, or an expression that defines a watchpoint.
The contents can be any location recognized by the break
command,
or in the case of a watchpoint, by the watch
command.
The breakpoint is initially marked as ‘invalid
’.
The breakpoint is not usable until it has been registered with GDB
with register-breakpoint!
, at which point it becomes ‘valid
’.
The result is the <gdb:breakpoint>
object representing the breakpoint.
The optional type
denotes the breakpoint to create.
This argument can be either BP_BREAKPOINT
or BP_WATCHPOINT
,
and defaults to BP_BREAKPOINT
.
The optional wp-class
argument defines the class of watchpoint to
create, if type
is BP_WATCHPOINT
. If a watchpoint class is
not provided, it is assumed to be a WP_WRITE
class.
The optional internal
argument allows the breakpoint to become
invisible to the user. The breakpoint will neither be reported when
registered, nor will it be listed in the output from info breakpoints
(but will be listed with the maint info breakpoints
command).
If an internal flag is not provided, the breakpoint is visible
(non-internal).
When a watchpoint is created, GDB will try to create a
hardware assisted watchpoint. If successful, the type of the watchpoint
is changed from BP_WATCHPOINT
to BP_HARDWARE_WATCHPOINT
for WP_WRITE
, BP_READ_WATCHPOINT
for WP_READ
,
and BP_ACCESS_WATCHPOINT
for WP_ACCESS
.
If not successful, the type of the watchpoint is left as WP_WATCHPOINT
.
The available types are represented by constants defined in the gdb
module:
BP_BREAKPOINT
Normal code breakpoint.
BP_WATCHPOINT
Watchpoint breakpoint.
BP_HARDWARE_WATCHPOINT
Hardware assisted watchpoint. This value cannot be specified when creating the breakpoint.
BP_READ_WATCHPOINT
Hardware assisted read watchpoint. This value cannot be specified when creating the breakpoint.
BP_ACCESS_WATCHPOINT
Hardware assisted access watchpoint. This value cannot be specified when creating the breakpoint.
The available watchpoint types represented by constants are defined in the
(gdb)
module:
WP_READ
Read only watchpoint.
WP_WRITE
Write only watchpoint.
WP_ACCESS
Read/Write watchpoint.
breakpoint
, a <gdb:breakpoint>
object, to GDB’s list of breakpoints. The breakpoint must have been created with make-breakpoint
. One cannot register breakpoints that have been created outside of Guile. Once a breakpoint is registered it becomes ‘valid
’. It is an error to register an already registered breakpoint. The result is unspecified.Remove breakpoint
from GDB’s list of breakpoints.
This also invalidates the Guile breakpoint
object.
Any further attempt to access the object will throw an exception.
If breakpoint
was created from Guile with make-breakpoint
it may be re-registered with GDB, in which case the breakpoint
becomes valid again.
<gdb:breakpoint>
object.#t
if object
is a <gdb:breakpoint>
object, and #f
otherwise.#t
if breakpoint
is valid, #f
otherwise. Breakpoints created with make-breakpoint
are marked as invalid until they are registered with GDB with register-breakpoint!
. A <gdb:breakpoint>
object can become invalid if the user deletes the breakpoint. In this case, the object still exists, but the underlying breakpoint does not. In the cases of watchpoint scope, the watchpoint remains valid even if execution of the inferior leaves the scope of that watchpoint.#t
if the breakpoint is visible to the user when hit, or when the ‘info breakpoints
’ command is run. Otherwise return #f
.#f
.#f
.#t
if the breakpoint is enabled, and #f
otherwise.breakpoint
to flag
. If flag is #f
it is disabled, otherwise it is enabled.Return #t
if the breakpoint is silent, and #f
otherwise.
Note that a breakpoint can also be silent if it has commands and the
first command is silent
. This is not reported by the
silent
attribute.
breakpoint
to flag
. If flag is #f
the breakpoint is made silent, otherwise it is made non-silent (or noisy).breakpoint
.breakpoint
to count
.breakpoint
.breakpoint
to count
. At present, count
must be zero.breakpoint
. Return #f if breakpoint
is not thread-specific.breakpoint
to global-thread-id
If set to #f
, the breakpoint is no longer thread-specific.#f
.breakpoint
to task
. If set to #f
, the breakpoint is no longer task-specific.breakpoint
, as specified by the user. It is a string. If there is no condition, return #f
.breakpoint
to condition
, which must be a string. If set to #f
then the breakpoint becomes unconditional.breakpoint
. See set-breakpoint-stop!
below in this section.Set the stop predicate of breakpoint
. The predicate
procedure
takes one argument: the <gdb:breakpoint> object.
If this predicate is set to a procedure then it is invoked whenever
the inferior reaches this breakpoint. If it returns #t
,
or any non-#f
value, then the inferior is stopped,
otherwise the inferior will continue.
If there are multiple breakpoints at the same location with a
stop
predicate, each one will be called regardless of the
return status of the previous. This ensures that all stop
predicates have a chance to execute at that location. In this scenario
if one of the methods returns #t
but the others return
#f
, the inferior will still be stopped.
You should not alter the execution state of the inferior (i.e., step, next, etc.), alter the current frame context (i.e., change the current active frame), or alter, add or delete any breakpoint. As a general rule, you should not alter any data within GDB or the inferior at this time.
Example stop
implementation:
(define (my-stop? bkpt) (let ((int-val (parse-and-eval "foo"))) (value=? int-val 3))) (define bkpt (make-breakpoint "main.c:42")) (register-breakpoint! bkpt) (set-breakpoint-stop! bkpt my-stop?)
breakpoint
as a string, or #f
if there are none.Next: Lazy Strings In Guile, Previous: Symbol Tables In Guile, Up: Guile API [Contents][Index]