Jinoh Kang : winedbg: Report current thread ID to GDB for all stop replies.

Alexandre Julliard julliard at winehq.org
Wed Nov 17 16:27:58 CST 2021


Module: wine
Branch: master
Commit: 829c06741bacfedb815d340e106371f6140bb79f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=829c06741bacfedb815d340e106371f6140bb79f

Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date:   Wed Nov 17 01:37:42 2021 +0900

winedbg: Report current thread ID to GDB for all stop replies.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winedbg/gdbproxy.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 522e4fdb506..a4f5bd1387e 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -867,6 +867,22 @@ static void packet_reply_status_xpoints(struct gdb_context* gdbctx, struct dbg_t
     }
 }
 
+static void packet_reply_begin_stop_reply(struct gdb_context* gdbctx, unsigned char signal)
+{
+    packet_reply_add(gdbctx, "T");
+    packet_reply_val(gdbctx, signal, 1);
+
+    /* We should always report the current thread ID for all stop replies.
+     * Otherwise, GDB complains with the following message:
+     *
+     *   Warning: multi-threaded target stopped without sending a thread-id,
+     *   using first non-exited thread
+     */
+    packet_reply_add(gdbctx, "thread:");
+    packet_reply_val(gdbctx, gdbctx->de.dwThreadId, 4);
+    packet_reply_add(gdbctx, ";");
+}
+
 static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
 {
     struct dbg_process *process = gdbctx->process;
@@ -885,11 +901,7 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
             return packet_error;
 
         packet_reply_open(gdbctx);
-        packet_reply_add(gdbctx, "T");
-        packet_reply_val(gdbctx, signal_from_debug_event(&gdbctx->de), 1);
-        packet_reply_add(gdbctx, "thread:");
-        packet_reply_val(gdbctx, gdbctx->de.dwThreadId, 4);
-        packet_reply_add(gdbctx, ";");
+        packet_reply_begin_stop_reply(gdbctx, signal_from_debug_event(&gdbctx->de));
         packet_reply_status_xpoints(gdbctx, thread, &ctx);
 
         for (i = 0; i < backend->gdb_num_regs; i++)
@@ -913,8 +925,7 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
     case LOAD_DLL_DEBUG_EVENT:
     case UNLOAD_DLL_DEBUG_EVENT:
         packet_reply_open(gdbctx);
-        packet_reply_add(gdbctx, "T");
-        packet_reply_val(gdbctx, HOST_SIGTRAP, 1);
+        packet_reply_begin_stop_reply(gdbctx, HOST_SIGTRAP);
         packet_reply_add(gdbctx, "library:;");
         packet_reply_close(gdbctx);
         return packet_done;




More information about the wine-cvs mailing list