aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-08-14 11:56:44 -0700
committerGitHub <noreply@github.com>2019-08-14 11:56:44 -0700
commitefce094b409179acbaa7726c112a10fcf8343503 (patch)
treee27b3b0a97f75126fd36450afb925b4c0ea3eb81 /src/server
parent7eaf60f1b58da45087fb8e5c5808b84b3451c990 (diff)
downloadriscv-openocd-efce094b409179acbaa7726c112a10fcf8343503.zip
riscv-openocd-efce094b409179acbaa7726c112a10fcf8343503.tar.gz
riscv-openocd-efce094b409179acbaa7726c112a10fcf8343503.tar.bz2
Don't fake step for hwthread rtos. (#393)
Fake step is a hack introduced to make things work with real RTOSs that have a concept of a current thread. The hwthread rtos always has access to all threads, so doesn't need it. This fixes a bug when running my MulticoreRegTest against HiFive Unleashed where OpenOCD would return the registers of the wrong thread after gdb stepped a hart. Change-Id: I64f538a133fb078c05a0c6b8121388b0b9d7f1b8
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index c9c8aae..56da6ed 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2808,8 +2808,7 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
* check if the thread to be stepped is the current rtos thread
* if not, we must fake the step
*/
- if (target->rtos->current_thread != thread_id)
- fake_step = true;
+ fake_step = rtos_needs_fake_step(target, thread_id);
}
if (parse[0] == ';') {
@@ -2849,15 +2848,10 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
log_add_callback(gdb_log_callback, connection);
target_call_event_callbacks(ct, TARGET_EVENT_GDB_START);
- /*
- * work around an annoying gdb behaviour: when the current thread
- * is changed in gdb, it assumes that the target can follow and also
- * make the thread current. This is an assumption that cannot hold
- * for a real target running a multi-threading OS. We just fake
- * the step to not trigger an internal error in gdb. See
- * https://sourceware.org/bugzilla/show_bug.cgi?id=22925 for details
- */
if (fake_step) {
+ /* We just fake the step to not trigger an internal error in
+ * gdb. See https://sourceware.org/bugzilla/show_bug.cgi?id=22925
+ * for details. */
int sig_reply_len;
char sig_reply[128];