summaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c
index a2bd8868..28387f44 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -606,6 +606,10 @@ int target_bulk_write_memory(struct target *target,
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,
@@ -617,6 +621,10 @@ int target_remove_breakpoint(struct target *target,
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,