|
From: openocd-gerrit <ope...@us...> - 2025-09-30 07:23:08
|
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 e5888bda38f4952e2ae92f7dc5b25fc9a2d1c2b3 (commit)
from 896738264e92b74a17250dab639999a2743d0b7c (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 e5888bda38f4952e2ae92f7dc5b25fc9a2d1c2b3
Author: Samuel Obuch <sam...@es...>
Date: Mon Aug 18 22:05:55 2025 +0200
target/breakpoints: drop duplicate breakpoint/watchpoint "clear_target" functions
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.
Change-Id: I8e85dbc66fd3e596990d631ed2aed22959a8ca60
Signed-off-by: Samuel Obuch <sam...@es...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9086
Reviewed-by: Evgeniy Naydanov <evg...@sy...>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 356dd6ec4..080e3360a 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -1041,8 +1041,8 @@ static int gdb_new_connection(struct connection *connection)
* GDB session could leave dangling breakpoints if e.g. communication
* timed out.
*/
- breakpoint_clear_target(target);
- watchpoint_clear_target(target);
+ breakpoint_remove_all(target);
+ watchpoint_remove_all(target);
/* Since version 3.95 (gdb-19990504), with the exclusion of 6.5~6.8, GDB
* sends an ACK at connection with the following comment in its source code:
@@ -3219,8 +3219,8 @@ static void gdb_restart_inferior(struct connection *connection, const char *pack
struct gdb_connection *gdb_con = connection->priv;
struct target *target = get_target_from_connection(connection);
- breakpoint_clear_target(target);
- watchpoint_clear_target(target);
+ breakpoint_remove_all(target);
+ watchpoint_remove_all(target);
command_run_linef(connection->cmd_ctx, "ocd_gdb_restart %s",
target_name(target));
/* set connection as attached after reset */
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index 54a6145ca..7254eac7d 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;
@@ -465,27 +467,6 @@ int watchpoint_remove_all(struct target *target)
return breakpoint_watchpoint_remove_all(target, WATCHPOINT);
}
-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;
-}
-
struct breakpoint *breakpoint_find(struct target *target, target_addr_t address)
{
struct breakpoint *breakpoint = target->breakpoints;
@@ -641,23 +622,6 @@ int watchpoint_remove(struct target *target, target_addr_t address)
return retval;
}
-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;
-}
-
int watchpoint_hit(struct target *target, enum watchpoint_rw *rw,
target_addr_t *address)
{
diff --git a/src/target/breakpoints.h b/src/target/breakpoints.h
index 0789267c7..d547a687f 100644
--- a/src/target/breakpoints.h
+++ b/src/target/breakpoints.h
@@ -50,7 +50,6 @@ struct watchpoint {
int unique_id;
};
-int breakpoint_clear_target(struct target *target);
int breakpoint_add(struct target *target,
target_addr_t address, unsigned int length, enum breakpoint_type type);
int context_breakpoint_add(struct target *target,
@@ -69,7 +68,6 @@ static inline void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int
breakpoint->number = hw_number;
}
-int watchpoint_clear_target(struct target *target);
int watchpoint_add(struct target *target,
target_addr_t address, unsigned int length,
enum watchpoint_rw rw, uint64_t value, uint64_t mask);
-----------------------------------------------------------------------
Summary of changes:
src/server/gdb_server.c | 8 ++++----
src/target/breakpoints.c | 40 ++--------------------------------------
src/target/breakpoints.h | 2 --
3 files changed, 6 insertions(+), 44 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|