aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-06-12 17:46:31 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-06-12 17:46:31 -0700
commit5747469eae56101bd167b450bc4d802162b113c0 (patch)
tree9cd3a83662c8c59c4272642b48aaef8c4bb9e7b7 /src
parentee1c404ef457f37aeeb26804421222d86b1b242f (diff)
downloadriscv-openocd-release.zip
riscv-openocd-release.tar.gz
riscv-openocd-release.tar.bz2
Jump to the RTOS hartid after haltingv20170612release
When I disappeared the polls everywhere I forgot to sanitize the hartid after halting. This is an invariant that GDB expects: when you return from a halt whatever thread is marked as currently selected is the thread that the next register accesses reference.
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index c232204..057b04b 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -736,6 +736,8 @@ int riscv_openocd_poll(struct target *target)
int riscv_openocd_halt(struct target *target)
{
+ RISCV_INFO(r);
+
LOG_DEBUG("halting all harts");
int out = riscv_halt_all_harts(target);
@@ -745,6 +747,11 @@ int riscv_openocd_halt(struct target *target)
}
register_cache_invalidate(target->reg_cache);
+ if (riscv_rtos_enabled(target)) {
+ target->rtos->current_threadid = r->rtos_hartid + 1;
+ target->rtos->current_thread = r->rtos_hartid + 1;
+ }
+
target->state = TARGET_HALTED;
target->debug_reason = DBG_REASON_DBGRQ;
target_call_event_callbacks(target, TARGET_EVENT_HALTED);