Eric Pouech : winedbg: In "info threads" commands, also show the name of the processes even if not debugged.

Alexandre Julliard julliard at winehq.org
Wed Dec 30 10:18:17 CST 2009


Module: wine
Branch: master
Commit: 280259aaca74cd6652b569e6f9c7cebd1f50abee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=280259aaca74cd6652b569e6f9c7cebd1f50abee

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Wed Dec 30 09:43:38 2009 +0100

winedbg: In "info threads" commands, also show the name of the processes even if not debugged.

---

 programs/winedbg/info.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c
index 2afdf75..e501f43 100644
--- a/programs/winedbg/info.c
+++ b/programs/winedbg/info.c
@@ -475,6 +475,22 @@ void info_win32_processes(void)
     }
 }
 
+static BOOL get_process_name(DWORD pid, PROCESSENTRY32* entry)
+{
+    BOOL   ret = FALSE;
+    HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+
+    if (snap != INVALID_HANDLE_VALUE)
+    {
+        entry->dwSize = sizeof(*entry);
+        if (Process32First(snap, entry))
+            while (!(ret = (entry->th32ProcessID == pid)) &&
+                   Process32Next(snap, entry));
+        CloseHandle(snap);
+    }
+    return ret;
+}
+
 void info_win32_threads(void)
 {
     HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
@@ -500,11 +516,19 @@ void info_win32_threads(void)
 		if (entry.th32OwnerProcessID != lastProcessId)
 		{
 		    struct dbg_process*	p = dbg_get_process(entry.th32OwnerProcessID);
+                    PROCESSENTRY32 pcs_entry;
+                    const char* exename;
+
+                    if (p)
+                        exename = dbg_W2A(p->imageName, -1);
+                    else if (get_process_name(entry.th32OwnerProcessID, &pcs_entry))
+                        exename = pcs_entry.szExeFile;
+                    else
+                        exename = "";
 
 		    dbg_printf("%08x%s %s\n",
-                               entry.th32OwnerProcessID, p ? " (D)" : "",
-                               p ? dbg_W2A(p->imageName, -1) : "");
-		    lastProcessId = entry.th32OwnerProcessID;
+                               entry.th32OwnerProcessID, p ? " (D)" : "", exename);
+                    lastProcessId = entry.th32OwnerProcessID;
 		}
                 dbg_printf("\t%08x %4d%s\n",
                            entry.th32ThreadID, entry.tpBasePri,




More information about the wine-cvs mailing list