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 <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9244
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Tomas Vanek
2025-11-21 09:27:20 +01:00
parent a1c7cd4fef
commit 37dcf4359b

View File

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