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

Brendan Shanks bshanks at codeweavers.com
Wed Mar 16 15:42:00 CDT 2022


Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---

v2: Use memory_get_string().

 programs/winedbg/gdbproxy.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 0268a288481..e9f3875db2d 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -482,8 +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)
             return FALSE;
@@ -493,12 +491,10 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
             thread = dbg_get_thread(gdbctx->process, threadname->dwThreadID);
         if (thread)
         {
-            if (gdbctx->process->process_io->read( gdbctx->process->handle,
-                threadname->szName, name, sizeof(name), &read) && read == sizeof(name))
-            {
-                fprintf(stderr, "Thread ID=%04lx renamed to \"%.9s\"\n",
-                    threadname->dwThreadID, name);
-            }
+            if (memory_get_string(gdbctx->process, threadname->szName, TRUE, FALSE,
+                                  thread->name, sizeof(thread->name)))
+                fprintf(stderr, "Thread ID=%04lx renamed to \"%s\"\n",
+                    threadname->dwThreadID, thread->name);
         }
         else
             ERR("Cannot set name of thread %04lx\n", threadname->dwThreadID);
-- 
2.34.1




More information about the wine-devel mailing list