[PATCH] [WineDbg]: bt all

Eric Pouech eric.pouech at wanadoo.fr
Sun May 14 11:08:43 CDT 2006


- fixed regression for command 'bt all'
- don't print 'process has terminated' message when
  detaching from a process (or backtracing it)

In details:
- bt all would crash when several processes were run
- bt <tid> could return a wrong back trace under some
  circonstances

A+
---

 programs/winedbg/stack.c      |    9 ++++++++-
 programs/winedbg/tgt_active.c |    2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index c0ea606..ba82d7f 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -315,7 +315,11 @@ static void backtrace_tid(struct dbg_pro
                 dbg_printf("Can't get context for thread 0x%lx in current process\n",
                            tid);
             }
-            else backtrace();
+            else
+            {
+                stack_fetch_frames();
+                backtrace();
+            }
             ResumeThread(dbg_curr_thread->handle);
         }
         else dbg_printf("Can't suspend thread 0x%lx in current process\n", tid);
@@ -333,6 +337,7 @@ static void backtrace_tid(struct dbg_pro
  */
 static void backtrace_all(void)
 {
+    struct dbg_process* process = dbg_curr_process;
     THREADENTRY32       entry;
     HANDLE              snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
 
@@ -372,6 +377,8 @@ static void backtrace_all(void)
             dbg_curr_process->process_io->close_process(dbg_curr_process, FALSE);
     }
     CloseHandle(snapshot);
+    dbg_curr_process = process;
+    dbg_curr_pid = process ? process->pid : 0;
 }
 
 void stack_backtrace(DWORD tid)
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index cdd50ad..ea7f22b 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -490,6 +490,7 @@ static unsigned dbg_handle_debug_event(D
             break;
         }
         tgt_process_active_close_process(dbg_curr_process, FALSE);
+        dbg_printf("Process of pid=0x%08lx has terminated\n", de->dwProcessId);
         break;
 
     case CREATE_THREAD_DEBUG_EVENT:
@@ -917,7 +918,6 @@ static BOOL tgt_process_active_close_pro
         if (!kill && !DebugActiveProcessStop(dbg_curr_pid)) return FALSE;
     }
     SymCleanup(pcs->handle);
-    dbg_printf("Process of pid=0x%08lx has terminated\n", pcs->pid);
     dbg_del_process(pcs);
 
     return TRUE;




More information about the wine-patches mailing list