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>
{
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
{
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
- if (target->state != TARGET_HALTED)
- {
- LOG_WARNING("target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
-
if (arm7_9->breakpoint_count == 0)
{
/* make sure we don't have any dangling breakpoints. This is vital upon
if (arm7_9->breakpoint_count == 0)
{
/* make sure we don't have any dangling breakpoints. This is vital upon
{
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
{
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
- if (target->state != TARGET_HALTED)
- {
- LOG_WARNING("target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
-
if (arm7_9->wp_available < 1)
{
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
if (arm7_9->wp_available < 1)
{
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
{
struct breakpoint *breakpoint = target->breakpoints;
struct breakpoint **breakpoint_p = &target->breakpoints;
{
struct breakpoint *breakpoint = target->breakpoints;
struct breakpoint **breakpoint_p = &target->breakpoints;
if (breakpoint == NULL)
return;
if (breakpoint == NULL)
return;
- target_remove_breakpoint(target, breakpoint);
+ retval = target_remove_breakpoint(target, breakpoint);
- LOG_DEBUG("BPID: %d", breakpoint->unique_id );
+ LOG_DEBUG("free BPID: %d --> %d", breakpoint->unique_id, retval);
(*breakpoint_p) = breakpoint->next;
free(breakpoint->orig_instr);
free(breakpoint);
(*breakpoint_p) = breakpoint->next;
free(breakpoint->orig_instr);
free(breakpoint);
{
struct watchpoint *watchpoint = target->watchpoints;
struct watchpoint **watchpoint_p = &target->watchpoints;
{
struct watchpoint *watchpoint = target->watchpoints;
struct watchpoint **watchpoint_p = &target->watchpoints;
if (watchpoint == NULL)
return;
if (watchpoint == NULL)
return;
- target_remove_watchpoint(target, watchpoint);
- LOG_DEBUG("WPID: %d", watchpoint->unique_id );
+ retval = target_remove_watchpoint(target, watchpoint);
+ LOG_DEBUG("free WPID: %d --> %d", watchpoint->unique_id, retval);
(*watchpoint_p) = watchpoint->next;
free(watchpoint);
}
(*watchpoint_p) = watchpoint->next;
free(watchpoint);
}
{
struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
{
struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
- /* REVISIT why check? DWT can be updated with core running ... */
- if (target->state != TARGET_HALTED)
- {
- LOG_WARNING("target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
-
if (cortex_m3->dwt_comp_available < 1)
{
LOG_DEBUG("no comparators?");
if (cortex_m3->dwt_comp_available < 1)
{
LOG_DEBUG("no comparators?");
int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
+ if (target->state != TARGET_HALTED) {
+ LOG_WARNING("target %s is not halted", target->cmd_name);
+ return ERROR_TARGET_NOT_HALTED;
+ }
return target->type->add_breakpoint(target, breakpoint);
}
int target_remove_breakpoint(struct target *target,
return target->type->add_breakpoint(target, breakpoint);
}
int target_remove_breakpoint(struct target *target,
int target_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
int target_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
+ if (target->state != TARGET_HALTED) {
+ LOG_WARNING("target %s is not halted", target->cmd_name);
+ return ERROR_TARGET_NOT_HALTED;
+ }
return target->type->add_watchpoint(target, watchpoint);
}
int target_remove_watchpoint(struct target *target,
return target->type->add_watchpoint(target, watchpoint);
}
int target_remove_watchpoint(struct target *target,
* Target must be halted while this is invoked as this
* will actually set up breakpoints on target.
*
* 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);
*
* 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);
* 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);
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);
* However, this method can be invoked on unresponsive targets.
*/
int (*remove_watchpoint)(struct target *target, struct watchpoint *watchpoint);
{
struct xscale_common *xscale = target_to_xscale(target);
{
struct xscale_common *xscale = target_to_xscale(target);
- if (target->state != TARGET_HALTED)
- {
- LOG_WARNING("target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
-
if ((breakpoint->type == BKPT_HARD) && (xscale->ibcr_available < 1))
{
LOG_INFO("no breakpoint unit available for hardware breakpoint");
if ((breakpoint->type == BKPT_HARD) && (xscale->ibcr_available < 1))
{
LOG_INFO("no breakpoint unit available for hardware breakpoint");
{
struct xscale_common *xscale = target_to_xscale(target);
{
struct xscale_common *xscale = target_to_xscale(target);
- if (target->state != TARGET_HALTED)
- {
- LOG_WARNING("target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
-
if (xscale->dbr_available < 1)
{
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
if (xscale->dbr_available < 1)
{
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)