Python code can manipulate breakpoints via the gdb.Breakpoint
class.
Create a new breakpoint. spec is 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 thewatch
command. The optional type denotes the breakpoint to create from the types defined later in this chapter. This argument can be either:BP_BREAKPOINT
orBP_WATCHPOINT
. type defaults toBP_BREAKPOINT
. The optional wp_class argument defines the class of watchpoint to create, if type is defined asBP_WATCHPOINT
. If a watchpoint class is not provided, it is assumed to be a WP_WRITE class.
The available watchpoint types represented by constants are defined in the
gdb
module:
Return
True
if thisBreakpoint
object is valid,False
otherwise. ABreakpoint
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.
This attribute is
True
if the breakpoint is enabled, andFalse
otherwise. This attribute is writable.
This attribute is
True
if the breakpoint is silent, andFalse
otherwise. This attribute is writable.Note that a breakpoint can also be silent if it has commands and the first command is
silent
. This is not reported by thesilent
attribute.
If the breakpoint is thread-specific, this attribute holds the thread id. If the breakpoint is not thread-specific, this attribute is
None
. This attribute is writable.
If the breakpoint is Ada task-specific, this attribute holds the Ada task id. If the breakpoint is not task-specific (or the underlying language is not Ada), this attribute is
None
. This attribute is writable.
This attribute holds the ignore count for the breakpoint, an integer. This attribute is writable.
This attribute holds the breakpoint's number — the identifier used by the user to manipulate the breakpoint. This attribute is not writable.
This attribute holds the breakpoint's type — the identifier used to determine the actual breakpoint type or use-case. This attribute is not writable.
The available types are represented by constants defined in the gdb
module:
BP_BREAKPOINT
BP_WATCHPOINT
BP_HARDWARE_WATCHPOINT
BP_READ_WATCHPOINT
BP_ACCESS_WATCHPOINT
This attribute holds the hit count for the breakpoint, an integer. This attribute is writable, but currently it can only be set to zero.
This attribute holds the location of the breakpoint, as specified by the user. It is a string. If the breakpoint does not have a location (that is, it is a watchpoint) the attribute's value is
None
. This attribute is not writable.
This attribute holds a breakpoint expression, as specified by the user. It is a string. If the breakpoint does not have an expression (the breakpoint is not a watchpoint) the attribute's value is
None
. This attribute is not writable.