diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 48b312ae5..c9c8aaec8 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2784,7 +2784,23 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p if (target->rtos != NULL) { /* 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);