For all targets, GDB can implement breakpoints and write access watchpoints in software, by inserting code in the target. However many targets provide hardware assistance for these functions which is far more efficient, and in addition may implement read access watchpoints.
These functions in struct target_ops provide a mechanism to access such functionality if it is available.
to_insert_breakpoint
and
to_remove_breakpoint
. These functions
insert and remove breakpoints on the target. They can choose to
use either hardware or software breakpoints. However if the
insert function allows use of hardware breakpoints, then the
GDB command
set breakpoint auto-hw off
will have no effect.
to_can_use_hw_breakpoint
. This function
should return 1 (true) if the target can set a hardware
breakpoint or watchpoint and 0 otherwise. The function is passed
an enumeration to indicate whether watchpoints or breakpoints
are being queried, and should use information about the number
of hardware breakpoints/watchpoints currently in use to
determine if a breakpoint/watchpoint can be set.
to_insert_hw_breakpoint
and
to_remove_hw_breakpoint
. Functions to
insert and remove hardware breakpoints. Return a failure result
if no hardware breakpoint is available.
to_insert_watchpoint
and
to_remove_watchpoint
. Functions to insert
and remove watchpoints.
to_stopped_by_watchpoint
. Function returns
1 (true) if the last stop was due to a watchpoint.
to_stopped_data_address
. If the last stop
was due to a watchpoint, this function returns the address of
the data which triggered the watchpoint.