[2/4] winedbg: 'winedbg --auto' and 'winedbg --minidump' should detach when done so as to not mess up the crashed process exit code.

Francois Gouget fgouget at codeweavers.com
Thu Aug 30 19:34:24 CDT 2007


---

If the debugger does not detach, then the crashed process gets a special 
exit code. In fact right now it's even worse as it gets the debugger's 
exit code which is 0. That means you can't even detect that the process 
crashed. But that's the subject of the next patch.

 dlls/kernel32/tests/debugger.c |    2 +-
 programs/winedbg/tgt_active.c  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index 54aae65..19ab840 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -237,7 +237,7 @@ static void crash_and_winedbg(HKEY hkey, const char* argv0)
     trace("waiting for child exit...\n");
     ok(WaitForSingleObject(info.hProcess, 60000) == WAIT_OBJECT_0, "Timed out waiting for the child to crash\n");
     ok(GetExitCodeProcess(info.hProcess, &exit_code), "GetExitCodeProcess failed: err=%d\n", GetLastError());
-    todo_wine ok(exit_code == STATUS_ACCESS_VIOLATION, "exit code = %08x\n", exit_code);
+    ok(exit_code == STATUS_ACCESS_VIOLATION, "exit code = %08x\n", exit_code);
     CloseHandle(info.hProcess);
 }
 
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 348895d..42bc9d6 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -893,7 +893,7 @@ enum dbg_start dbg_active_auto(int argc, char* argv[])
         if (ds != start_ok) return ds;
         hFile = parser_generate_command_file("echo Modules:", "info share",
                                              "echo Threads:", "info threads",
-                                             NULL);
+                                             "detach", NULL);
     }
     else if (!strcmp(argv[0], "--minidump"))
     {
@@ -942,7 +942,7 @@ enum dbg_start dbg_active_auto(int argc, char* argv[])
             /* FIXME: should generate unix name as well */
             dbg_printf("Capturing program state in %s\n", tmp + 9);
         }
-        hFile = parser_generate_command_file(tmp, NULL);
+        hFile = parser_generate_command_file(tmp, "detach", NULL);
     }
     else return start_error_parse;
     if (hFile == INVALID_HANDLE_VALUE) return start_error_parse;
-- 
1.5.2.4




More information about the wine-patches mailing list