aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErhan Kurubas <erhan.kurubas@espressif.com>2022-10-18 17:23:15 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2022-10-21 18:16:23 +0000
commit535de48ca69ba34860067dfe5ea6f7fa6638f7f9 (patch)
tree1e453e446fa165aaa5ff0874ab3df9ece820e383 /src
parentb8735bbf7ed7eedb0590edbf2a22929b401887ba (diff)
downloadriscv-openocd-535de48ca69ba34860067dfe5ea6f7fa6638f7f9.zip
riscv-openocd-535de48ca69ba34860067dfe5ea6f7fa6638f7f9.tar.gz
riscv-openocd-535de48ca69ba34860067dfe5ea6f7fa6638f7f9.tar.bz2
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 <erhan.kurubas@espressif.com> Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e Reviewed-on: https://review.openocd.org/c/openocd/+/7274 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/xtensa/xtensa.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index c1b5f43..c2c047e 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -1630,7 +1630,6 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in
target->debug_reason = DBG_REASON_SINGLESTEP;
target->state = TARGET_HALTED;
- target_call_event_callbacks(target, TARGET_EVENT_HALTED);
LOG_DEBUG("Done stepping, PC=%" PRIX32, cur_pc);
if (cause & DEBUGCAUSE_DB) {
@@ -1658,7 +1657,12 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in
int xtensa_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
{
- return xtensa_do_step(target, current, address, handle_breakpoints);
+ int retval = xtensa_do_step(target, current, address, handle_breakpoints);
+ if (retval != ERROR_OK)
+ return retval;
+ target_call_event_callbacks(target, TARGET_EVENT_HALTED);
+
+ return ERROR_OK;
}
/**