aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2020-01-31 12:56:46 -0800
committerGitHub <noreply@github.com>2020-01-31 12:56:46 -0800
commit7cb8843794a258380b7c37509e5c693977675b2a (patch)
treecf77dbdcd20ef4c53a01acea66aa8116133926c6
parent2f456abd5509476246b4eeadc0e273c8e6df569c (diff)
downloadriscv-openocd-7cb8843794a258380b7c37509e5c693977675b2a.zip
riscv-openocd-7cb8843794a258380b7c37509e5c693977675b2a.tar.gz
riscv-openocd-7cb8843794a258380b7c37509e5c693977675b2a.tar.bz2
Update the current thread when gdb requests a step. (#444)
Evidently this is what gdb expects. Change-Id: I634cdbcbcfab149c1b916e3744ff4915a8f8669b
-rw-r--r--src/rtos/riscv_debug.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rtos/riscv_debug.c b/src/rtos/riscv_debug.c
index f14a62d..2b6e931 100644
--- a/src/rtos/riscv_debug.c
+++ b/src/rtos/riscv_debug.c
@@ -257,12 +257,13 @@ static int riscv_gdb_v_packet(struct connection *connection, const char *packet,
if (sscanf(packet_stttrr, "vCont;s:%d;c", &threadid) == 1) {
riscv_set_rtos_hartid(target, threadid - 1);
riscv_step_rtos_hart(target);
+ /* Stepping changes the current thread to whichever thread was stepped. */
+ target->rtos->current_threadid = threadid;
gdb_put_packet(connection, "S05", 3);
return JIM_OK;
- }
- if (strcmp(packet_stttrr, "vCont;c") == 0) {
+ } else if (strcmp(packet_stttrr, "vCont;c") == 0) {
target_call_event_callbacks(target, TARGET_EVENT_GDB_START);
target_call_event_callbacks(target, TARGET_EVENT_RESUME_START);
riscv_set_all_rtos_harts(target);
@@ -272,10 +273,10 @@ static int riscv_gdb_v_packet(struct connection *connection, const char *packet,
target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
target_call_event_callbacks(target, TARGET_EVENT_RESUME_END);
return JIM_OK;
- }
- if (strncmp(packet_stttrr, "vCont", 5) == 0)
+ } else if (strncmp(packet_stttrr, "vCont", 5) == 0) {
LOG_ERROR("Got unknown vCont-type packet");
+ }
return GDB_THREAD_PACKET_NOT_CONSUMED;
}