Wow, nice! I think I saw this bug and didn't know why before.
-John

-----Original Message-----
From: ger...@openocd.org <ger...@openocd.org> 
Sent: Friday, September 12, 2025 1:59 PM
To: openocd-devel@lists.sourceforge.net
Subject: [EXTERNAL] [PATCH]: 52ecc325aa target/breakpoints: resolve SMP + SW 
breakpoint inconsistencies

WARNING: External Email Alert

This email has been sent from outside of the Draper network.

Please treat the email with caution, especially if you are requested to click 
on a link, decrypt/open an attachment, or enable macros. For further 
information on how to spot phishing, access "Phishing Awareness Policy" on the 
Draper Portal and report phishing by clicking the "Report Suspicious" button on 
the Outlook toolbar

This is an automated email from Gerrit.

"Samuel Obuch <samuel.ob...@espressif.com>" just uploaded a new patch set to 
Gerrit, which you can find at 
https://urldefense.us/v2/url?u=https-3A__review.openocd.org_c_openocd_-2B_9120&d=DwICAg&c=m5mye7XjY-PNBUdjUS9G7n0DDGwujM2TWPAftzw2VTE&r=ILTxQ-BydeKdMcD7cBYXJnoLPJ7Afuxo693QbxGGh2g&m=7V3nIagGMsN24h1Ahptwu3JApM-OE99ZzUvV3Z0_b9WIAWgfzoY-doBMsXyKYfUg&s=cQqeBYJ4MTHI42Yu8e8RE_E9w-a6XYJkECY6RhTA6io&e=

-- gerrit

commit 52ecc325aa66c71fb25b4681ce249660073edeba
Author: Samuel Obuch <samuel.ob...@espressif.com>
Date:   Fri Sep 12 19:39:12 2025 +0200

    target/breakpoints: resolve SMP + SW breakpoint inconsistencies

    Software breakpoints are only added for the first target
    in an SMP group. This is because of the assumption, that
    they will still be active on all targets.

    Therefore to remain consistent:

    - Display SW breakpoints for all targets when using 'bp' command;

    - Look for SW breakpoints on the first target from an SMP group
      in 'breakpoint_find'.

    Change-Id: Ib8f1683e734b2822d3602b7dfdc1a1b55bfb65dd
    Signed-off-by: Samuel Obuch <samuel.ob...@espressif.com>

diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 
54a6145caa..9ceaed2aca 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -495,6 +495,18 @@ struct breakpoint *breakpoint_find(struct target *target, 
target_addr_t address)
                        return breakpoint;
                breakpoint = breakpoint->next;
        }
+       if (target->smp) {
+               struct target_list *head;
+               head = list_first_entry(target->smp_targets, struct 
target_list, lh);
+               if (target != head->target) {
+                       breakpoint = head->target->breakpoints;
+                       while (breakpoint) {
+                               if (breakpoint->type == BKPT_SOFT && 
breakpoint->address == address)
+                                       return breakpoint;
+                               breakpoint = breakpoint->next;
+                       }
+               }
+       }

        return NULL;
 }
diff --git a/src/target/target.c b/src/target/target.c index 
1bdbee19a7..3a4991874f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3923,15 +3923,7 @@ static int handle_bp_command_list(struct 
command_invocation *cmd)
        struct target *target = get_current_target(cmd->ctx);
        struct breakpoint *breakpoint = target->breakpoints;
        while (breakpoint) {
-               if (breakpoint->type == BKPT_SOFT) {
-                       char *buf = buf_to_hex_str(breakpoint->orig_instr,
-                                       breakpoint->length * 8);
-                       command_print(cmd, "Software breakpoint(IVA): addr=" 
TARGET_ADDR_FMT ", len=0x%x, orig_instr=0x%s",
-                                       breakpoint->address,
-                                       breakpoint->length,
-                                       buf);
-                       free(buf);
-               } else {
+               if (breakpoint->type == BKPT_HARD) {
                        if ((breakpoint->address == 0) && (breakpoint->asid != 
0))
                                command_print(cmd, "Context breakpoint: 
asid=0x%8.8" PRIx32 ", len=0x%x, num=%u",
                                                        breakpoint->asid, @@ 
-3950,6 +3942,24 @@ static int handle_bp_command_list(struct command_invocation 
*cmd)

                breakpoint = breakpoint->next;
        }
+       if (target->smp) {
+               struct target_list *head;
+               head = list_first_entry(target->smp_targets, struct 
target_list, lh);
+               target = head->target;
+       }
+       breakpoint = target->breakpoints;
+       while (breakpoint) {
+               if (breakpoint->type == BKPT_SOFT) {
+                       char *buf = buf_to_hex_str(breakpoint->orig_instr, 
breakpoint->length * 8);
+                       command_print(cmd, "Software breakpoint(IVA): addr=" 
TARGET_ADDR_FMT ", len=0x%x, orig_instr=0x%s",
+                                               breakpoint->address,
+                                               breakpoint->length,
+                                               buf);
+                       free(buf);
+               }
+
+               breakpoint = breakpoint->next;
+       }
        return ERROR_OK;
 }


--


Reply via email to