diff options
author | Ian Thompson <ianst@cadence.com> | 2022-08-29 07:34:18 -0700 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-09-13 22:09:02 +0000 |
commit | abe5f015c501942c0c71741f95c49994e386df61 (patch) | |
tree | 1e94e22af7f5656cb2cca2596de259e02812f4d0 | |
parent | 34a6a64920cb9f106a3a12542ac1297229833c1e (diff) | |
download | riscv-openocd-abe5f015c501942c0c71741f95c49994e386df61.zip riscv-openocd-abe5f015c501942c0c71741f95c49994e386df61.tar.gz riscv-openocd-abe5f015c501942c0c71741f95c49994e386df61.tar.bz2 |
target/xtensa: fix step state transition
For some configurations, notably on DAP systems, resolve issue where single-stepping does not always transition into the HALTED state.
Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I053f4eaffad8c3228878ba87580ada640e4bd2fe
Reviewed-on: https://review.openocd.org/c/openocd/+/7150
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r-- | src/target/xtensa/xtensa.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c index 0c975a4..2e978b3 100644 --- a/src/target/xtensa/xtensa.c +++ b/src/target/xtensa/xtensa.c @@ -1586,11 +1586,8 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in target->state = TARGET_RUNNING; return ERROR_FAIL; } - target->debug_reason = DBG_REASON_SINGLESTEP; - target->state = TARGET_HALTED; xtensa_fetch_all_regs(target); - cur_pc = xtensa_reg_get(target, XT_REG_IDX_PC); LOG_TARGET_DEBUG(target, @@ -1620,6 +1617,10 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in LOG_DEBUG("Stepped from %" PRIX32 " to %" PRIX32, oldpc, cur_pc); break; } while (true); + + 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) { |