[PATCH 1/4] winedbg: Set thread->name from MSVC exception when in GDB proxy mode.

Brendan Shanks bshanks at codeweavers.com
Tue Mar 15 14:05:14 CDT 2022


Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
 programs/winedbg/gdbproxy.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 0268a288481..bcde120adeb 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -482,7 +482,6 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
     {
         const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation;
         struct dbg_thread *thread;
-        char name[9];
         SIZE_T read;
 
         if (threadname->dwType != 0x1000)
@@ -494,10 +493,12 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
         if (thread)
         {
             if (gdbctx->process->process_io->read( gdbctx->process->handle,
-                threadname->szName, name, sizeof(name), &read) && read == sizeof(name))
+                threadname->szName, thread->name, sizeof(thread->name), &read) &&
+                read == sizeof(thread->name))
             {
-                fprintf(stderr, "Thread ID=%04lx renamed to \"%.9s\"\n",
-                    threadname->dwThreadID, name);
+                thread->name[sizeof(thread->name) - 1] = '\0';
+                fprintf(stderr, "Thread ID=%04lx renamed to \"%s\"\n",
+                    threadname->dwThreadID, thread->name);
             }
         }
         else
-- 
2.34.1




More information about the wine-devel mailing list