target: Fix an issue with rwp/rbp command in smp targets 10/7910/5
authorKirill Radkin <kirill.radkin@syntacore.com>
Tue, 26 Sep 2023 13:49:09 +0000 (16:49 +0300)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 14 Oct 2023 11:59:34 +0000 (11:59 +0000)
If wp/bp is missing at address rwp/rbp won't return zero code (on smp).
Now it fixed.

Fixes: 022e438292de ("target: Change policy of removing watchpoints/breakpoints.")
Change-Id: I3a3c245f7088fc23227b286d2191fc7f3edba702
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7910
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/breakpoints.c

index 5ce0346bb4664d2eba05b07b89d091518e2a0781..4a613cc284f8d9c64113e3987c44ed8a3b31dad4 100644 (file)
@@ -367,8 +367,10 @@ int breakpoint_remove(struct target *target, target_addr_t address)
                }
        }
 
-       if (num_found_breakpoints == 0)
+       if (num_found_breakpoints == 0) {
                LOG_TARGET_ERROR(target, "no breakpoint at address " TARGET_ADDR_FMT " found", address);
+               return ERROR_BREAKPOINT_NOT_FOUND;
+       }
 
        return retval;
 }
@@ -591,7 +593,7 @@ int watchpoint_remove(struct target *target, target_addr_t address)
                                num_found_watchpoints++;
 
                                if (status != ERROR_OK) {
-                                       LOG_TARGET_ERROR(curr, "failed to remove watchpoint at address" TARGET_ADDR_FMT, address);
+                                       LOG_TARGET_ERROR(curr, "failed to remove watchpoint at address " TARGET_ADDR_FMT, address);
                                        retval = status;
                                }
                        }
@@ -603,12 +605,14 @@ int watchpoint_remove(struct target *target, target_addr_t address)
                        num_found_watchpoints++;
 
                        if (retval != ERROR_OK)
-                               LOG_TARGET_ERROR(target, "failed to remove watchpoint at address" TARGET_ADDR_FMT, address);
+                               LOG_TARGET_ERROR(target, "failed to remove watchpoint at address " TARGET_ADDR_FMT, address);
                }
        }
 
-       if (num_found_watchpoints == 0)
+       if (num_found_watchpoints == 0) {
                LOG_TARGET_ERROR(target, "no watchpoint at address " TARGET_ADDR_FMT " found", address);
+               return ERROR_WATCHPOINT_NOT_FOUND;
+       }
 
        return retval;
 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)