From 37dcf4359bd22025aaa809a8559b129ed6607195 Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Fri, 21 Nov 2025 09:27:20 +0100 Subject: [PATCH] target/cortex_a: emit 'resumed' event for all SMP cores In a SMP configuration 'resumed' event was emitted only for the active core, in contradiction to 'halted' event, which gets emitted for all cores from the SMP group: > resume target event 3 (resume-start) for core stm32mp15x.cpu0 target event 2 (resumed) for core stm32mp15x.cpu0 target event 4 (resume-end) for core stm32mp15x.cpu0 target event 7 (gdb-start) for core stm32mp15x.cpu0 > halt target event 0 (gdb-halt) for core stm32mp15x.cpu1 target event 1 (halted) for core stm32mp15x.cpu1 target event 0 (gdb-halt) for core stm32mp15x.cpu0 target event 1 (halted) for core stm32mp15x.cpu0 target event 8 (gdb-end) for core stm32mp15x.cpu0 Emit 'resumed' event in cortex_a_restore_smp(). While on it replace adding the returned errors together with the proper error handling. Change-Id: I9debef0884519cde767707f78f163b136ecc7aa5 Signed-off-by: Tomas Vanek Reviewed-on: https://review.openocd.org/c/openocd/+/9244 Reviewed-by: Antonio Borneo Tested-by: jenkins --- src/target/cortex_a.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index a9c034b55..3d8603a4b 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -968,7 +968,7 @@ static int cortex_a_internal_restart(struct target *target) static int cortex_a_restore_smp(struct target *target, bool handle_breakpoints) { - int retval = 0; + int retval = ERROR_OK; struct target_list *head; target_addr_t address; @@ -977,9 +977,17 @@ static int cortex_a_restore_smp(struct target *target, bool handle_breakpoints) if ((curr != target) && (curr->state != TARGET_RUNNING) && target_was_examined(curr)) { /* resume current address , not in step mode */ - retval += cortex_a_internal_restore(curr, true, &address, + int retval2 = cortex_a_internal_restore(curr, true, &address, handle_breakpoints, false); - retval += cortex_a_internal_restart(curr); + + if (retval2 == ERROR_OK) + retval2 = cortex_a_internal_restart(curr); + + if (retval2 == ERROR_OK) + target_call_event_callbacks(curr, TARGET_EVENT_RESUMED); + + if (retval == ERROR_OK) + retval = retval2; // save the first error } } return retval;