This is an automated email from Gerrit. "Farid Khaydari <f.khayd...@syntacore.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8738
-- gerrit commit 070a3f0457398fc9000cf7bc97fbed92f34b3c7d Author: Farid Khaydari <f.khayd...@syntacore.com> Date: Tue Feb 4 15:37:53 2025 +0300 target: add watchpoint diagnostics as command output YCAT-39123 Added WP diagnostics for duplicating WPs as command output Change-Id: Icfc46ae167c57d93c532034afa2b7f043fb0a8db Signed-off-by: Farid Khaydari <f.khayd...@syntacore.com> diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index a080416291..fd42f6c623 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -516,10 +516,12 @@ static int watchpoint_add_internal(struct target *target, target_addr_t address, LOG_TARGET_ERROR(target, "address " TARGET_ADDR_FMT " already has watchpoint %d", address, watchpoint->unique_id); - return ERROR_FAIL; + return ERROR_WATCHPOINT_SAME_ADDRESS; } /* ignore duplicate watchpoint */ + LOG_TARGET_WARNING(target, "watchpoint %d" + " already exist", watchpoint->unique_id); return ERROR_OK; } watchpoint_p = &watchpoint->next; diff --git a/src/target/breakpoints.h b/src/target/breakpoints.h index 0789267c7d..951fd58df0 100644 --- a/src/target/breakpoints.h +++ b/src/target/breakpoints.h @@ -88,5 +88,6 @@ static inline void watchpoint_set(struct watchpoint *watchpoint, unsigned int nu #define ERROR_BREAKPOINT_NOT_FOUND (-1600) #define ERROR_WATCHPOINT_NOT_FOUND (-1601) +#define ERROR_WATCHPOINT_SAME_ADDRESS (-1602) #endif /* OPENOCD_TARGET_BREAKPOINTS_H */ diff --git a/src/target/target.c b/src/target/target.c index 8deab8f34d..c0dbde518e 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4125,8 +4125,13 @@ COMMAND_HANDLER(handle_wp_command) int retval = watchpoint_add(target, addr, length, type, data_value, data_mask); + + if (retval == ERROR_WATCHPOINT_SAME_ADDRESS) + command_print(CMD, "address " TARGET_ADDR_FMT + " already has watchpoint", addr); + if (retval != ERROR_OK) - LOG_TARGET_ERROR(target, "Failure setting watchpoints"); + command_print(CMD, "Failure setting watchpoints"); return retval; } --