diff options
author | Jon Burgess <jburgess777@gmail.com> | 2014-09-18 19:57:34 +0100 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2014-09-29 20:11:59 +0000 |
commit | 1601c1a40be5be45dd7b4192afc16d256f0ebe0d (patch) | |
tree | 3d31cb3700a9dca282d20b0c68798e959b65d2b5 /src/server/gdb_server.c | |
parent | 0a5e03c12aff31767483218232795bf8fa8df63b (diff) |
gdb_server: Include current RTOS thread in signal packets
This allows GDB to automatically switch to the thread that has
been interrupted and show you where it has stopped.
Change-Id: Icb9500dc42a61eb977e9fac55ce9503c9926bf5d
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
Reviewed-on: http://openocd.zylin.com/2303
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/server/gdb_server.c')
-rw-r--r-- | src/server/gdb_server.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 2912c743..152a06c7 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -714,11 +714,14 @@ static int gdb_output(struct command_context *context, const char *line) static void gdb_signal_reply(struct target *target, struct connection *connection) { struct gdb_connection *gdb_connection = connection->priv; - char sig_reply[20]; + char sig_reply[45]; char stop_reason[20]; + char current_thread[25]; int sig_reply_len; int signal_var; + rtos_update_threads(target); + if (target->debug_reason == DBG_REASON_EXIT) { sig_reply_len = snprintf(sig_reply, sizeof(sig_reply), "W00"); } else { @@ -754,13 +757,18 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio } } - sig_reply_len = snprintf(sig_reply, sizeof(sig_reply), "T%2.2x%s", - signal_var, stop_reason); + current_thread[0] = '\0'; + if (target->rtos != NULL) { + snprintf(current_thread, sizeof(current_thread), "thread:%016" PRIx64 ";", target->rtos->current_thread); + target->rtos->current_threadid = target->rtos->current_thread; + } + + sig_reply_len = snprintf(sig_reply, sizeof(sig_reply), "T%2.2x%s%s", + signal_var, stop_reason, current_thread); } gdb_put_packet(connection, sig_reply, sig_reply_len); gdb_connection->frontend_state = TARGET_HALTED; - rtos_update_threads(target); } static void gdb_fileio_reply(struct target *target, struct connection *connection) |