summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/target/breakpoints.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index ac8d7dfd..cc38d029 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -224,8 +224,17 @@ int watchpoint_remove(target_t *target, u32 address)
{
if ((retval = target->type->remove_watchpoint(target, watchpoint)) != ERROR_OK)
{
- ERROR("BUG: can't remove watchpoint");
- exit(-1);
+ switch (retval)
+ {
+ case ERROR_TARGET_NOT_HALTED:
+ INFO("can't remove watchpoint while target is running");
+ return retval;
+ break;
+ default:
+ ERROR("unknown error");
+ exit(-1);
+ break;
+ }
}
(*watchpoint_p) = watchpoint->next;
free(watchpoint);