diff options
author | Tim Newsome <tim@sifive.com> | 2019-01-25 09:19:33 -0800 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2019-01-25 09:19:33 -0800 |
commit | b29215735cf150266f3b9928276fe3fc48d2fa1e (patch) | |
tree | a8209e41f68a7fcfc24bb2c6a2eeec86bdc8a697 | |
parent | afedcb337a79517462765aa62b1988c8857cc724 (diff) | |
download | riscv-openocd-b29215735cf150266f3b9928276fe3fc48d2fa1e.zip riscv-openocd-b29215735cf150266f3b9928276fe3fc48d2fa1e.tar.gz riscv-openocd-b29215735cf150266f3b9928276fe3fc48d2fa1e.tar.bz2 |
Properly clean up SMP watchpoints.
42/43 tests pass.
Change-Id: Ia800ffacf914742e8b9bdb1799ca3817856448a4
-rw-r--r-- | src/target/breakpoints.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 9645f84..f76c318 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -497,7 +497,7 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint free(watchpoint); } -void watchpoint_remove(struct target *target, target_addr_t address) +int watchpoint_remove_internal(struct target *target, target_addr_t address) { struct watchpoint *watchpoint = target->watchpoints; @@ -507,10 +507,32 @@ void watchpoint_remove(struct target *target, target_addr_t address) watchpoint = watchpoint->next; } - if (watchpoint) + if (watchpoint) { watchpoint_free(target, watchpoint); - else - LOG_ERROR("no watchpoint at address " TARGET_ADDR_FMT " found", address); + return 1; + } else { + if (!target->smp) + LOG_ERROR("no watchpoint at address " TARGET_ADDR_FMT " found", address); + return 0; + } +} + +void watchpoint_remove(struct target *target, target_addr_t address) +{ + int found = 0; + if (target->smp) { + struct target_list *head; + struct target *curr; + head = target->head; + while (head != (struct target_list *)NULL) { + curr = head->target; + found += watchpoint_remove_internal(curr, address); + head = head->next; + } + if (found == 0) + LOG_ERROR("no watchpoint at address " TARGET_ADDR_FMT " found", address); + } else + watchpoint_remove_internal(target, address); } void watchpoint_clear_target(struct target *target) |