[PATCH 2/3] winedbg: Use debug event code in packet_reply_status.

Rémi Bernon rbernon at codeweavers.com
Tue Apr 7 12:34:17 CDT 2020


This will help expand later the cases to tell gdb about the cause of the
break.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 programs/winedbg/gdbproxy.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index b3c4002b3b35..332fb0c9d3b6 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -874,10 +874,11 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
     dbg_ctx_t ctx;
     size_t i;
 
-    if (process != NULL)
+    switch (gdbctx->de.dwDebugEventCode)
     {
+    default:
+        if (!process) return packet_error;
         if (!(backend = process->be_cpu)) return packet_error;
-
         if (!(thread = dbg_get_thread(process, gdbctx->de.dwThreadId)) ||
             !backend->get_context(thread->handle, &ctx))
             return packet_error;
@@ -900,13 +901,13 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
 
         packet_reply_close(gdbctx);
         return packet_done;
-    }
-    else
-    {
-        /* Try to put an exit code
-         * Cannot use GetExitCodeProcess, wouldn't fit in a 8 bit value, so
-         * just indicate the end of process and exit */
-        return packet_reply(gdbctx, "W00") | packet_last_f;
+
+    case EXIT_PROCESS_DEBUG_EVENT:
+        packet_reply_open(gdbctx);
+        packet_reply_add(gdbctx, "W");
+        packet_reply_val(gdbctx, gdbctx->de.u.ExitProcess.dwExitCode, 4);
+        packet_reply_close(gdbctx);
+        return packet_done | packet_last_f;
     }
 }
 
-- 
2.26.0




More information about the wine-devel mailing list