diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-11-28 10:40:26 -0800 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-11-28 10:40:26 -0800 |
commit | acbe054a38a45432f5948026e1e9258b4e2910c2 (patch) | |
tree | 126e4c5fbe6d3d8261e994171f7f45855bf59a16 /src/target/target_type.h | |
parent | 68889ea02f28bfd61f0b4b85aad4b0bf8826a947 (diff) |
target: uplevel add_{break,watch}point() error checks
In target_type.h it's documented that the target must be
halted for add_breakpoint() ... and with slight ambiguity,
also for its add_watchpoint() sibling. So rather than
verifying that constraint in the CPU drivers, do it in the
target_add_{break,watch}point() routines.
Add minor paranoia on the remove_*point() paths too: save
the return value, and print it out in in the LOG_DEBUG message
in case it's nonzero.
Note that with some current cores, like all ARMv7 ones I've
looked at, there's no technical issue preventing watchpoint or
breakpoint add/remove operations on active cores. This model
seems deeply wired into OpenOCD though.
ALSO: the ARM targets were fairly "good" about enforcing that
constraint themselves. The MIPS ones were relied on other code
to catch such stuff, but it's not clear such code existed ...
keep an eye out for new issues on MIPS.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/target_type.h')
-rw-r--r-- | src/target/target_type.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/target/target_type.h b/src/target/target_type.h index 333b58b4..d141608b 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -124,18 +124,24 @@ struct target_type * Target must be halted while this is invoked as this * will actually set up breakpoints on target. * - * The breakpoint hardware will be set up upon adding the first breakpoint. + * The breakpoint hardware will be set up upon adding the + * first breakpoint. * * Upon GDB connection all breakpoints/watchpoints are cleared. */ int (*add_breakpoint)(struct target *target, struct breakpoint *breakpoint); - /* remove breakpoint. hw will only be updated if the target is currently halted. + /* remove breakpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_breakpoint)(struct target *target, struct breakpoint *breakpoint); + + /* add watchpoint ... see add_breakpoint() comment above. */ int (*add_watchpoint)(struct target *target, struct watchpoint *watchpoint); - /* remove watchpoint. hw will only be updated if the target is currently halted. + + /* remove watchpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_watchpoint)(struct target *target, struct watchpoint *watchpoint); |