[PATCH v2 6/6] winedbg: Prefer thread name from GetThreadDescription() in GDB proxy mode.
Brendan Shanks
bshanks at codeweavers.com
Wed Mar 16 15:42:03 CDT 2022
Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
v2: Use the fetch_thread_description() previously added to info.c.
programs/winedbg/gdbproxy.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index e9f3875db2d..eb1246c5912 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -1773,6 +1773,7 @@ static enum packet_return packet_query_threads(struct gdb_context* gdbctx)
struct reply_buffer* reply = &gdbctx->qxfer_buffer;
struct dbg_process* process = gdbctx->process;
struct dbg_thread* thread;
+ WCHAR* description;
if (!process) return packet_error;
@@ -1786,7 +1787,19 @@ 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=\"");
- if (strlen(thread->name))
+ if ((description = fetch_thread_description(thread->tid)))
+ {
+ char* name;
+ int len;
+
+ len = WideCharToMultiByte(CP_ACP, 0, description, -1, NULL, 0, NULL, NULL);
+ name = HeapAlloc(GetProcessHeap(), 0, len);
+ if (WideCharToMultiByte(CP_ACP, 0, description, -1, name, len, NULL, NULL))
+ reply_buffer_append_str(reply, name);
+ HeapFree(GetProcessHeap(), 0, name);
+ LocalFree(description);
+ }
+ else if (strlen(thread->name))
{
reply_buffer_append_str(reply, thread->name);
}
--
2.34.1
More information about the wine-devel
mailing list