Skip to content

Commit 535de48

Browse files
erhankurborneoa
authored andcommitted
target/xtensa: remove redundant call for TARGET_EVENT_HALTED
`xtensa_do_step` is invoked from `xtensa_prepare_resume` to silently step over BP/WP before resuming. For example; in the case of WPs (DEBUGCAUSE_DB), in the current implementation `xtensa_do_step` will generate one more `TARGET_EVENT_HALTED` after the original one caused by WP itself. This patch moves the halted event cb call after the step is done successfully. Signed-off-by: Erhan Kurubas <[email protected]> Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e Reviewed-on: https://review.openocd.org/c/openocd/+/7274 Tested-by: jenkins Reviewed-by: Ian Thompson <[email protected]> Reviewed-by: Antonio Borneo <[email protected]>
1 parent b8735bb commit 535de48

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/target/xtensa/xtensa.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,6 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in
16301630

16311631
target->debug_reason = DBG_REASON_SINGLESTEP;
16321632
target->state = TARGET_HALTED;
1633-
target_call_event_callbacks(target, TARGET_EVENT_HALTED);
16341633
LOG_DEBUG("Done stepping, PC=%" PRIX32, cur_pc);
16351634

16361635
if (cause & DEBUGCAUSE_DB) {
@@ -1658,7 +1657,12 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in
16581657

16591658
int xtensa_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
16601659
{
1661-
return xtensa_do_step(target, current, address, handle_breakpoints);
1660+
int retval = xtensa_do_step(target, current, address, handle_breakpoints);
1661+
if (retval != ERROR_OK)
1662+
return retval;
1663+
target_call_event_callbacks(target, TARGET_EVENT_HALTED);
1664+
1665+
return ERROR_OK;
16621666
}
16631667

16641668
/**

0 commit comments

Comments
 (0)