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://review.openocd.org/c/openocd/+/9120

-- 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