aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2018-11-12 13:01:55 -0800
committerGitHub <noreply@github.com>2018-11-12 13:01:55 -0800
commitf042dcb0a3a76bbe6030de53b873a79ba1506b41 (patch)
tree915a3f719429903789f088a83b21e4846068066e
parent498faf93e13cc8555d70a1040c4eff7a10905492 (diff)
downloadriscv-openocd-f042dcb0a3a76bbe6030de53b873a79ba1506b41.zip
riscv-openocd-f042dcb0a3a76bbe6030de53b873a79ba1506b41.tar.gz
riscv-openocd-f042dcb0a3a76bbe6030de53b873a79ba1506b41.tar.bz2
examine() should leave halted harts halted (#327)
Previously all harts would be resumed at the end of examine(). Fixes #326. Change-Id: Id82b361e98f151911f8679538ee4b3c754efd6a5
-rw-r--r--src/target/riscv/riscv-013.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index ccb0032..00714aa 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1470,7 +1470,8 @@ static int examine(struct target *target)
dmi_write(target, DMI_DMCONTROL,
set_hartsel(DMI_DMCONTROL_DMACTIVE | DMI_DMCONTROL_ACKHAVERESET, i));
- if (!riscv_is_halted(target)) {
+ bool halted = riscv_is_halted(target);
+ if (!halted) {
if (riscv013_halt_current_hart(target) != ERROR_OK) {
LOG_ERROR("Fatal: Hart %d failed to halt during examine()", i);
return ERROR_FAIL;
@@ -1500,6 +1501,9 @@ static int examine(struct target *target)
* really slow simulators. */
LOG_DEBUG(" hart %d: XLEN=%d, misa=0x%" PRIx64, i, r->xlen[i],
r->misa[i]);
+
+ if (!halted)
+ riscv013_resume_current_hart(target);
}
LOG_DEBUG("Enumerated %d harts", r->hart_count);
@@ -1509,11 +1513,6 @@ static int examine(struct target *target)
return ERROR_FAIL;
}
- /* Resumes all the harts, so the debugger can later pause them. */
- /* TODO: Only do this if the harts were halted to start with. */
- riscv_resume_all_harts(target);
- target->state = TARGET_RUNNING;
-
target_set_examined(target);
if (target->rtos)