aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeniy Naydanov <109669442+en-sc@users.noreply.github.com>2024-04-27 16:44:09 +0300
committerGitHub <noreply@github.com>2024-04-27 16:44:09 +0300
commit687f00c06055026331fa34250dcb05c9f652c361 (patch)
tree5f8a011e78e2423f7d85468203e7b9f370a89339 /src
parent9563cd67e650426ceaac1d330fda84f7ad1b26a6 (diff)
parent665fbf605b04e4ea2ad9af1c789f1b11588ec863 (diff)
downloadriscv-openocd-687f00c06055026331fa34250dcb05c9f652c361.zip
riscv-openocd-687f00c06055026331fa34250dcb05c9f652c361.tar.gz
riscv-openocd-687f00c06055026331fa34250dcb05c9f652c361.tar.bz2
Merge pull request #1031 from aap-sc/aap-sc/hart_status_info_fixup
fix confusing status messages during resume
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 2365e82..d20897f 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -1713,15 +1713,26 @@ static int oldriscv_step(struct target *target, int current, uint32_t address,
return tt->step(target, current, address, handle_breakpoints);
}
-static int old_or_new_riscv_step(struct target *target, int current,
- target_addr_t address, int handle_breakpoints)
+static int riscv_openocd_step_impl(struct target *target, int current,
+ target_addr_t address, int handle_breakpoints, int handle_callbacks);
+
+static int old_or_new_riscv_step_impl(struct target *target, int current,
+ target_addr_t address, int handle_breakpoints, int handle_callbacks)
{
RISCV_INFO(r);
LOG_TARGET_DEBUG(target, "handle_breakpoints=%d", handle_breakpoints);
if (!r->get_hart_state)
return oldriscv_step(target, current, address, handle_breakpoints);
else
- return riscv_openocd_step(target, current, address, handle_breakpoints);
+ return riscv_openocd_step_impl(target, current, address, handle_breakpoints,
+ handle_callbacks);
+}
+
+static int old_or_new_riscv_step(struct target *target, int current,
+ target_addr_t address, int handle_breakpoints)
+{
+ return old_or_new_riscv_step_impl(target, current, address,
+ handle_breakpoints, true /* handle callbacks*/);
}
static int riscv_examine(struct target *target)
@@ -2095,7 +2106,8 @@ static int resume_prep(struct target *target, int current,
/* To be able to run off a trigger, we perform a step operation and then
* resume. If handle_breakpoints is true then step temporarily disables
* pending breakpoints so we can safely perform the step. */
- if (old_or_new_riscv_step(target, current, address, handle_breakpoints) != ERROR_OK)
+ if (old_or_new_riscv_step_impl(target, current, address, handle_breakpoints,
+ false /* callbacks are not called */) != ERROR_OK)
return ERROR_FAIL;
}
@@ -3298,8 +3310,8 @@ int riscv_openocd_poll(struct target *target)
return ERROR_OK;
}
-int riscv_openocd_step(struct target *target, int current,
- target_addr_t address, int handle_breakpoints)
+static int riscv_openocd_step_impl(struct target *target, int current,
+ target_addr_t address, int handle_breakpoints, int handle_callbacks)
{
LOG_TARGET_DEBUG(target, "stepping hart");
@@ -3365,14 +3377,25 @@ _exit:
if (success) {
target->state = TARGET_RUNNING;
- target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
+ if (handle_callbacks)
+ target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
+
target->state = TARGET_HALTED;
target->debug_reason = DBG_REASON_SINGLESTEP;
- target_call_event_callbacks(target, TARGET_EVENT_HALTED);
+ if (handle_callbacks)
+ target_call_event_callbacks(target, TARGET_EVENT_HALTED);
}
+
return success ? ERROR_OK : ERROR_FAIL;
}
+int riscv_openocd_step(struct target *target, int current,
+ target_addr_t address, int handle_breakpoints)
+{
+ return riscv_openocd_step_impl(target, current, address, handle_breakpoints,
+ true /* handle_callbacks */);
+}
+
/* Command Handlers */
COMMAND_HANDLER(riscv_set_command_timeout_sec)
{