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 <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9086
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Samuel Obuch
2025-08-18 22:05:55 +02:00
committed by Tomas Vanek
parent 896738264e
commit e5888bda38
3 changed files with 6 additions and 44 deletions

View File

@@ -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 */