This is an automated email from Gerrit. "Samuel Obuch <samuel.ob...@espressif.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9086
-- gerrit commit c65fc58dffad01186d5ec29b498e35d24bd1cd89 Author: Samuel Obuch <samuel.ob...@espressif.com> Date: Mon Aug 18 22:05:55 2025 +0200 target/breakpoints: account for SMP in watchpoint_clear_target We need to cleanup watchpoints on all targets in SMP group when GDB connects. Otherwise, the targets will not be consistent. Once thats fixed, both *_clear_target functions clearly duplicate the corresponding *_remove_all functions, and we can reuse the same helper function to simplify. Change-Id: I8e85dbc66fd3e596990d631ed2aed22959a8ca60 Signed-off-by: Samuel Obuch <samuel.ob...@espressif.com> diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index a080416291..c5d83fce50 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -412,6 +412,8 @@ static int watchpoint_free(struct target *target, struct watchpoint *watchpoint_ static int watchpoint_remove_all_internal(struct target *target) { + LOG_TARGET_DEBUG(target, "Delete all watchpoints"); + struct watchpoint *watchpoint = target->watchpoints; int retval = ERROR_OK; @@ -467,23 +469,7 @@ int watchpoint_remove_all(struct target *target) int breakpoint_clear_target(struct target *target) { - int retval = ERROR_OK; - - if (target->smp) { - struct target_list *head; - - foreach_smp_target(head, target->smp_targets) { - struct target *curr = head->target; - int status = breakpoint_remove_all_internal(curr); - - if (status != ERROR_OK) - retval = status; - } - } else { - retval = breakpoint_remove_all_internal(target); - } - - return retval; + return breakpoint_watchpoint_remove_all(target, BREAKPOINT); } struct breakpoint *breakpoint_find(struct target *target, target_addr_t address) @@ -643,19 +629,7 @@ int watchpoint_remove(struct target *target, target_addr_t address) int watchpoint_clear_target(struct target *target) { - LOG_TARGET_DEBUG(target, "Delete all watchpoints"); - - struct watchpoint *watchpoint = target->watchpoints; - int retval = ERROR_OK; - - while (watchpoint) { - struct watchpoint *tmp = watchpoint; - watchpoint = watchpoint->next; - int status = watchpoint_free(target, tmp); - if (status != ERROR_OK) - retval = status; - } - return retval; + return breakpoint_watchpoint_remove_all(target, WATCHPOINT); } int watchpoint_hit(struct target *target, enum watchpoint_rw *rw, --