forked from auracaster/openocd
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 <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/9210 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Antonio Borneo
parent
5ff384be08
commit
a247ff1223
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user