|
From: openocd-gerrit <ope...@us...> - 2023-11-18 11:20:18
|
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 7c60f6593edd692cff90b8486412a9b8adba28d2 (commit)
from f8096ce68724d15d0ef9a7edfd6d2aaa0f83a6e5 (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 7c60f6593edd692cff90b8486412a9b8adba28d2
Author: Kirill Radkin <kir...@sy...>
Date: Wed Oct 18 19:13:25 2023 +0300
breakpoints: Fix endless loop in bp/wp_clear_target
If we can't remove bp/wp, we will stuck in endless loop
Change-Id: I44c0a164db1d15c0a0637d33c75087a49cf5c0f4
Signed-off-by: Kirill Radkin <kir...@sy...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7940
Tested-by: jenkins
Reviewed-by: Anatoly P <kup...@gm...>
Reviewed-by: Tim Newsome <ti...@si...>
Reviewed-by: Jan Matyas <jan...@co...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index d9c12f523..d4662c4de 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -326,6 +326,8 @@ static int breakpoint_remove_internal(struct target *target, target_addr_t addre
static int breakpoint_remove_all_internal(struct target *target)
{
+ LOG_TARGET_DEBUG(target, "Delete all breakpoints");
+
struct breakpoint *breakpoint = target->breakpoints;
int retval = ERROR_OK;
@@ -464,22 +466,6 @@ int watchpoint_remove_all(struct target *target)
return breakpoint_watchpoint_remove_all(target, WATCHPOINT);
}
-static int breakpoint_clear_target_internal(struct target *target)
-{
- LOG_DEBUG("Delete all breakpoints for target: %s",
- target_name(target));
-
- int retval = ERROR_OK;
-
- while (target->breakpoints) {
- int status = breakpoint_free(target, target->breakpoints);
- if (status != ERROR_OK)
- retval = status;
- }
-
- return retval;
-}
-
int breakpoint_clear_target(struct target *target)
{
int retval = ERROR_OK;
@@ -489,13 +475,13 @@ int breakpoint_clear_target(struct target *target)
foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
- int status = breakpoint_clear_target_internal(curr);
+ int status = breakpoint_remove_all_internal(curr);
if (status != ERROR_OK)
retval = status;
}
} else {
- retval = breakpoint_clear_target_internal(target);
+ retval = breakpoint_remove_all_internal(target);
}
return retval;
@@ -659,16 +645,19 @@ int watchpoint_remove(struct target *target, target_addr_t address)
int watchpoint_clear_target(struct target *target)
{
- int retval = ERROR_OK;
-
LOG_DEBUG("Delete all watchpoints for target: %s",
target_name(target));
- while (target->watchpoints) {
- int status = watchpoint_free(target, target->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;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/breakpoints.c | 35 ++++++++++++-----------------------
1 file changed, 12 insertions(+), 23 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|