|
From: openocd-gerrit <ope...@us...> - 2025-11-22 19:28:09
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via a247ff122380a6a6e14878b462785fc209f875b0 (commit)
from 5ff384be086a82e05901f37e07d16ab2b585c4c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a247ff122380a6a6e14878b462785fc209f875b0
Author: Tomas Vanek <va...@fb...>
Date: Mon Nov 3 11:07:31 2025 +0100
target, breakpoints: report hit watchpoint in trivial case
Some targets have no means to find out which watchpoint triggered
the debug halt. Resolve properly the trivial and most used case
when only one watchpoint is set.
Change-Id: I683933ec43e6ca0fed84a08a2aa222ed8a6e277f
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9210
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index d65e5594f..fa6b635f0 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -629,6 +629,20 @@ int watchpoint_hit(struct target *target, enum watchpoint_rw *rw,
struct watchpoint *hit_watchpoint;
retval = target_hit_watchpoint(target, &hit_watchpoint);
+ if (retval == ERROR_NOT_IMPLEMENTED
+ && target->debug_reason == DBG_REASON_WATCHPOINT) {
+ // Handle the trivial case: only one watchpoint is set
+ unsigned int cnt = 0;
+ struct watchpoint *wp = target->watchpoints;
+ while (wp) {
+ cnt++;
+ wp = wp->next;
+ }
+ if (cnt == 1) {
+ retval = ERROR_OK;
+ hit_watchpoint = target->watchpoints;
+ }
+ }
if (retval != ERROR_OK)
return ERROR_FAIL;
diff --git a/src/target/target.c b/src/target/target.c
index 3d807ba35..ababa57fb 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1360,9 +1360,9 @@ int target_hit_watchpoint(struct target *target,
if (!target->type->hit_watchpoint) {
/* For backward compatible, if hit_watchpoint is not implemented,
- * return ERROR_FAIL such that gdb_server will not take the nonsense
+ * return error such that gdb_server will not take the nonsense
* information. */
- return ERROR_FAIL;
+ return ERROR_NOT_IMPLEMENTED;
}
return target->type->hit_watchpoint(target, hit_watchpoint);
-----------------------------------------------------------------------
Summary of changes:
src/target/breakpoints.c | 14 ++++++++++++++
src/target/target.c | 4 ++--
2 files changed, 16 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|