This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9562
-- gerrit commit 14c84433d2e5880eff4ad46f03e8b0d9893819d0 Author: Antonio Borneo <[email protected]> Date: Fri Apr 3 15:59:59 2026 +0200 cortex_a: compute locally the resume address The caller cortex_a_resume() needs to know the resume address in order to use it in a log message after the resume action. Compute locally the resume address, instead of getting it back from the callee through a pointer. This simplifies the implementation of a dual action resume that uses a single-step to skip a watchpoint, followed by the resume action. Change-Id: Icab4428a4571d07b9c1c6eff54f686e7028fc807 Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index f3589f5811..27fafe3d82 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -895,7 +895,7 @@ static int cortex_a_halt(struct target *target) } static int cortex_a_internal_restore(struct target *target, bool current, - target_addr_t *address, bool handle_breakpoints, bool debug_execution) + target_addr_t address, bool handle_breakpoints, bool debug_execution) { struct armv7a_common *armv7a = target_to_armv7a(target); struct arm *arm = &armv7a->arm; @@ -927,11 +927,10 @@ static int cortex_a_internal_restore(struct target *target, bool current, #endif /* current = true: continue on current pc, otherwise continue at <address> */ - resume_pc = buf_get_u32(arm->pc->value, 0, 32); - if (!current) - resume_pc = *address; + if (current) + resume_pc = buf_get_u32(arm->pc->value, 0, 32); else - *address = resume_pc; + resume_pc = address; /* Make sure that the Armv7 gdb thumb fixups does not * kill the return address @@ -1052,14 +1051,13 @@ static int cortex_a_restore_smp(struct target *target, bool handle_breakpoints) { int retval = ERROR_OK; struct target_list *head; - target_addr_t address; foreach_smp_target(head, target->smp_targets) { struct target *curr = head->target; if ((curr != target) && (curr->state != TARGET_RUNNING) && target_was_examined(curr)) { /* resume current address , not in step mode */ - int retval2 = cortex_a_internal_restore(curr, true, &address, + int retval2 = cortex_a_internal_restore(curr, true, 0, handle_breakpoints, false); if (retval2 == ERROR_OK) @@ -1088,7 +1086,12 @@ static int cortex_a_resume(struct target *target, bool current, target_call_event_callbacks(target, TARGET_EVENT_RESUMED); return 0; } - cortex_a_internal_restore(target, current, &address, handle_breakpoints, + + struct armv7a_common *armv7a = target_to_armv7a(target); + struct arm *arm = &armv7a->arm; + target_addr_t resume_pc = current ? buf_get_u32(arm->pc->value, 0, 32) : address; + + cortex_a_internal_restore(target, current, address, handle_breakpoints, debug_execution); if (target->smp) { target->gdb_service->core[0] = -1; @@ -1101,11 +1104,11 @@ static int cortex_a_resume(struct target *target, bool current, if (!debug_execution) { target->state = TARGET_RUNNING; target_call_event_callbacks(target, TARGET_EVENT_RESUMED); - LOG_TARGET_DEBUG(target, "target resumed at " TARGET_ADDR_FMT, address); + LOG_TARGET_DEBUG(target, "target resumed at " TARGET_ADDR_FMT, resume_pc); } else { target->state = TARGET_DEBUG_RUNNING; target_call_event_callbacks(target, TARGET_EVENT_DEBUG_RESUMED); - LOG_TARGET_DEBUG(target, "target debug resumed at " TARGET_ADDR_FMT, address); + LOG_TARGET_DEBUG(target, "target debug resumed at " TARGET_ADDR_FMT, resume_pc); } return ERROR_OK; --
