This is an automated email from Gerrit. "Tim Newsome <t...@sifive.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6873
-- gerrit commit 9797e4ab5701aa6b9d6ae3a7300cb73e9e02dd4d Author: Tim Newsome <t...@sifive.com> Date: Mon May 20 14:16:07 2019 -0700 Don't update threads on single step. Sometimes that would result in picking a different thread than gdb just requested to step. Then we fake it, and now there's a different thread selected than gdb expects, so register accesses go to the wrong one! E.g.: ``` Hg1$ P8=72101ce197869329$ # write r8 on thread 1 g$ vCont?$ vCont;s:1;c$ # rtos_update_threads changes to other thread g$ qXfer:threads:read::0,fff$ P8=cc060607eb89ca7f$ # write r8 on other thread g$ ``` See https://github.com/riscv/riscv-openocd/pull/376 Change-Id: I1fb44d5a7792835f66342f590a5f7bbf8c21b64e Signed-off-by: Tim Newsome <t...@sifive.com> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 4dee7e8642..b3992103b7 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2962,7 +2962,23 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p if (target->rtos) { /* FIXME: why is this necessary? rtos state should be up-to-date here already! */ - rtos_update_threads(target); + + /* Sometimes this results in picking a different thread than + * gdb just requested to step. Then we fake it, and now there's + * a different thread selected than gdb expects, so register + * accesses go to the wrong one! + * E.g.: + * Hg1$ + * P8=72101ce197869329$ # write r8 on thread 1 + * g$ + * vCont?$ + * vCont;s:1;c$ # rtos_update_threads changes to other thread + * g$ + * qXfer:threads:read::0,fff$ + * P8=cc060607eb89ca7f$ # write r8 on other thread + * g$ + * */ + /* rtos_update_threads(target); */ target->rtos->gdb_target_for_threadid(connection, thread_id, &ct); --