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, ""); 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;