Brendan Shanks : winedbg: Don't set initial thread->name to the tid.

Alexandre Julliard julliard at winehq.org
Tue Mar 1 15:45:34 CST 2022


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

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Thu Feb 24 10:34:04 2022 -0800

winedbg: Don't set initial thread->name to the tid.

Currently the name is only used by GDB, send the tid there.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winedbg/gdbproxy.c | 11 ++++++++++-
 programs/winedbg/winedbg.c  |  3 +--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 89985c06666..0268a288481 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -1790,7 +1790,16 @@ static enum packet_return packet_query_threads(struct gdb_context* gdbctx)
         reply_buffer_append_str(reply, "id=\"");
         reply_buffer_append_uinthex(reply, thread->tid, 4);
         reply_buffer_append_str(reply, "\" name=\"");
-        reply_buffer_append_str(reply, thread->name);
+        if (strlen(thread->name))
+        {
+            reply_buffer_append_str(reply, thread->name);
+        }
+        else
+        {
+            char tid[5];
+            snprintf(tid, sizeof(tid), "%04lx", thread->tid);
+            reply_buffer_append_str(reply, tid);
+        }
         reply_buffer_append_str(reply, "\"/>");
     }
     reply_buffer_append_str(reply, "</threads>");
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 95318eeb2f1..89fb265fc93 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -444,6 +444,7 @@ struct dbg_thread* dbg_add_thread(struct dbg_process* p, DWORD tid,
     t->step_over_bp.enabled = FALSE;
     t->step_over_bp.refcount = 0;
     t->stopped_xpoint = -1;
+    t->name[0] = '\0';
     t->in_exception = FALSE;
     t->frames = NULL;
     t->num_frames = 0;
@@ -451,8 +452,6 @@ struct dbg_thread* dbg_add_thread(struct dbg_process* p, DWORD tid,
     t->addr_mode = AddrModeFlat;
     t->suspended = FALSE;
 
-    snprintf(t->name, sizeof(t->name), "%04lx", tid);
-
     list_add_head(&p->threads, &t->entry);
 
     return t;




More information about the wine-cvs mailing list