diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 73e53a2cd36..68cf2a65015 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -375,8 +375,6 @@ extern void dbg_wait_next_exception(DWORD cont, int count, int mode) extern enum dbg_start dbg_active_attach(int argc, char* argv[]); extern enum dbg_start dbg_active_launch(int argc, char* argv[]); extern enum dbg_start dbg_active_auto(int argc, char* argv[]); - /* temporary for tgt_active.c */ -extern unsigned dbg_main_loop(HANDLE); /* tgt_minidump.c */ extern void minidump_write(const char*, const EXCEPTION_RECORD*); diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index e778c3dbda1..a52d9023887 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -644,7 +644,7 @@ void dbg_wait_next_exception(DWORD cont, int count, int mode) dbg_curr_thread->exec_count); } -/*static*/ unsigned dbg_main_loop(HANDLE hFile) +static void dbg_wait_for_first_exception(void) { DEBUG_EVENT de; @@ -656,10 +656,6 @@ void dbg_wait_next_exception(DWORD cont, int count, int mode) { if (dbg_handle_debug_event(&de)) break; } - dbg_interactiveP = TRUE; - parser_handle(hFile); - - return 0; } static unsigned dbg_start_debuggee(LPSTR cmdLine) @@ -703,6 +699,7 @@ static unsigned dbg_start_debuggee(LPSTR cmdLine) } dbg_curr_pid = info.dwProcessId; if (!(dbg_curr_process = dbg_add_process(dbg_curr_pid, 0))) return FALSE; + dbg_wait_for_first_exception(); return TRUE; } @@ -754,17 +751,12 @@ enum dbg_start dbg_active_attach(int argc, char* argv[]) /* try the form pid */ if (argc == 1 && str2int(argv[0], &pid) && pid != 0) { - if (dbg_attach_debuggee(pid, FALSE, FALSE)) - { - dbg_curr_pid = pid; - return start_ok; - } - return start_error_init; + if (!dbg_attach_debuggee(pid, FALSE, FALSE)) + return start_error_init; } - /* try the form pid evt (Win32 JIT debugger) */ - if (argc == 2 && str2int(argv[0], &pid) && pid != 0 && - str2int(argv[1], &evt) && evt != 0) + else if (argc == 2 && str2int(argv[0], &pid) && pid != 0 && + str2int(argv[1], &evt) && evt != 0) { if (!dbg_attach_debuggee(pid, TRUE, FALSE)) { @@ -778,10 +770,12 @@ enum dbg_start dbg_active_attach(int argc, char* argv[]) return start_error_init; } CloseHandle((HANDLE)evt); - dbg_curr_pid = pid; - return start_ok; } - return start_error_parse; + else return start_error_parse; + + dbg_curr_pid = pid; + dbg_wait_for_first_exception(); + return start_ok; } /****************************************************************** @@ -895,7 +889,10 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) } else return start_error_parse; if (hFile == INVALID_HANDLE_VALUE) return start_error_parse; - dbg_main_loop(hFile); + + dbg_interactiveP = TRUE; + parser_handle(hFile); + return start_ok; } diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index cd4073410ea..472d365da46 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -550,11 +550,13 @@ int main(int argc, char** argv) case start_error_init: return -1; } - retv = dbg_main_loop(hFile); + dbg_interactiveP = TRUE; + parser_handle(hFile); + while (dbg_process_list) dbg_process_list->process_io->close_process(dbg_process_list, TRUE); dbg_save_internal_vars(); - return retv; + return 0; }