diff --git a/debugger/break.c b/debugger/break.c index 2bc0e0cb8ea..4f12579bc7a 100644 --- a/debugger/break.c +++ b/debugger/break.c @@ -746,13 +746,14 @@ static BOOL DEBUG_ShallBreak( int bpnum ) * Determine if we should continue execution after a SIGTRAP signal when * executing in the given mode. */ -BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, int * count ) +BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count ) { - int bpnum; - DWORD oldval; - int wpnum; - enum dbg_mode addr_mode; - struct symbol_info syminfo; + int bpnum; + DWORD oldval; + int wpnum; + enum dbg_mode addr_mode; + struct symbol_info syminfo; + enum exec_mode mode = DEBUG_CurrThread->exec_mode; #ifdef __i386__ /* If not single-stepping, back up over the int3 instruction */ @@ -833,7 +834,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, int * If we are about to stop, then print out the source line if we * have it. */ - if (mode != EXEC_CONT && mode != EXEC_PASS && mode != EXEC_FINISH) + if (mode != EXEC_CONT && mode != EXEC_FINISH) { DEBUG_FindNearestSymbol( addr, TRUE, NULL, 0, &syminfo.list); if( syminfo.list.sourcefile != NULL ) @@ -853,7 +854,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, int #endif /* no breakpoint, continue if in continuous mode */ - return (mode == EXEC_CONT || mode == EXEC_PASS || mode == EXEC_FINISH); + return (mode == EXEC_CONT || mode == EXEC_FINISH); } /*********************************************************************** @@ -873,14 +874,14 @@ void DEBUG_SuspendExecution( void ) * Set the breakpoints to the correct state to restart execution * in the given mode. */ -enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ) +void DEBUG_RestartExecution( int count ) { DBG_ADDR addr; DBG_ADDR addr2; int bp; int delta; int status; - enum exec_mode ret_mode; + enum exec_mode mode, ret_mode; DWORD instr; unsigned char ch; @@ -890,7 +891,7 @@ enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ) * This is the mode we will be running in after we finish. We would like * to be able to modify this in certain cases. */ - ret_mode = mode; + ret_mode = mode = DEBUG_CurrThread->exec_mode; bp = DEBUG_FindBreakpoint( &addr, DBG_BREAK ); if ( bp != -1 && bp != 0) @@ -971,7 +972,6 @@ enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ) switch(mode) { case EXEC_CONT: /* Continuous execution */ - case EXEC_PASS: /* Continue, passing exception */ #ifdef __i386__ DEBUG_context.EFlags &= ~STEP_FLAG; #endif @@ -1030,7 +1030,7 @@ enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ) RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); } DEBUG_CurrThread->stepOverBP = breakpoints[0]; - return ret_mode; + DEBUG_CurrThread->exec_mode = ret_mode; } int diff --git a/debugger/dbg.y b/debugger/dbg.y index 71267ceeb20..74ca63d8caa 100644 --- a/debugger/dbg.y +++ b/debugger/dbg.y @@ -103,31 +103,30 @@ line: command | error tEOL { yyerrok; } command: - tQUIT tEOL { return EXIT_QUIT; } + tQUIT tEOL { DEBUG_ExitMode = EXIT_QUIT; return 1; } | tHELP tEOL { DEBUG_Help(); } | tHELP tINFO tEOL { DEBUG_HelpInfo(); } - | tCONT tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_CONT; return EXIT_CONT; } - | tPASS tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_PASS; return EXIT_CONT; } - | tCONT tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2; - DEBUG_CurrThread->dbg_exec_mode = EXEC_CONT; return EXIT_CONT; } - | tSTEP tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_INSTR; return EXIT_CONT; } - | tNEXT tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_OVER; return EXIT_CONT; } - | tSTEP tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_INSTR; return EXIT_CONT; } - | tNEXT tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_OVER; return EXIT_CONT; } - | tSTEPI tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_INSTR; return EXIT_CONT; } - | tNEXTI tEOL { DEBUG_CurrThread->dbg_exec_count = 1; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_OVER; return EXIT_CONT; } - | tSTEPI tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_INSTR; return EXIT_CONT; } - | tNEXTI tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2; - DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_OVER; return EXIT_CONT; } + | tCONT tEOL { DEBUG_CurrThread->exec_count = 1; + DEBUG_CurrThread->exec_mode = EXEC_CONT; return 1; } + | tPASS tEOL { DEBUG_ExitMode = EXIT_PASS; return 1; } + | tCONT tNUM tEOL { DEBUG_CurrThread->exec_count = $2; + DEBUG_CurrThread->exec_mode = EXEC_CONT; return 1; } + | tSTEP tEOL { DEBUG_CurrThread->exec_count = 1; + DEBUG_CurrThread->exec_mode = EXEC_STEP_INSTR; return 1; } + | tNEXT tEOL { DEBUG_CurrThread->exec_count = 1; + DEBUG_CurrThread->exec_mode = EXEC_STEP_OVER; return 1; } + | tSTEP tNUM tEOL { DEBUG_CurrThread->exec_count = $2; + DEBUG_CurrThread->exec_mode = EXEC_STEP_INSTR; return 1; } + | tNEXT tNUM tEOL { DEBUG_CurrThread->exec_count = $2; + DEBUG_CurrThread->exec_mode = EXEC_STEP_OVER; return 1; } + | tSTEPI tEOL { DEBUG_CurrThread->exec_count = 1; + DEBUG_CurrThread->exec_mode = EXEC_STEPI_INSTR; return 1; } + | tNEXTI tEOL { DEBUG_CurrThread->exec_count = 1; + DEBUG_CurrThread->exec_mode = EXEC_STEPI_OVER; return 1; } + | tSTEPI tNUM tEOL { DEBUG_CurrThread->exec_count = $2; + DEBUG_CurrThread->exec_mode = EXEC_STEPI_INSTR; return 1; } + | tNEXTI tNUM tEOL { DEBUG_CurrThread->exec_count = $2; + DEBUG_CurrThread->exec_mode = EXEC_STEPI_OVER; return 1; } | tABORT tEOL { kill(getpid(), SIGABRT); } | tMODE tNUM tEOL { mode_command($2); } | tMODE tVM86 tEOL { DEBUG_CurrThread->dbg_mode = MODE_VM86; } @@ -141,8 +140,8 @@ command: | tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); } | tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); } | tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); } - | tFINISH tEOL { DEBUG_CurrThread->dbg_exec_count = 0; - DEBUG_CurrThread->dbg_exec_mode = EXEC_FINISH; return EXIT_CONT; } + | tFINISH tEOL { DEBUG_CurrThread->exec_count = 0; + DEBUG_CurrThread->exec_mode = EXEC_FINISH; return 1; } | tSHOW tDIR tEOL { DEBUG_ShowDir(); } | tDIR pathname tEOL { DEBUG_AddPath( $2 ); } | tDIR tEOL { DEBUG_NukePath(); } @@ -157,8 +156,8 @@ command: | tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); } | tSYMBOLFILE pathname tEOL { DEBUG_ReadSymbolTable($2); } | tWHATIS expr_addr tEOL { DEBUG_PrintType(&$2); DEBUG_FreeExprMem(); } - | tATTACH tNUM tEOL { if (DEBUG_Attach($2, FALSE)) return EXIT_CONT; } - | tDETACH tEOL { return EXIT_DETACH; } + | tATTACH tNUM tEOL { if (DEBUG_Attach($2, FALSE)) return 1; } + | tDETACH tEOL { DEBUG_ExitMode = EXIT_DETACH; return 1; } | list_command | disassemble_command | set_command @@ -409,29 +408,27 @@ static WINE_EXCEPTION_FILTER(wine_dbg_cmd) * * Debugger editline parser */ -enum exit_mode DEBUG_Parser(void) +void DEBUG_Parser(void) { BOOL ret_ok; - enum exit_mode ret = EXIT_CONT; #ifdef YYDEBUG yydebug = 0; #endif yyin = stdin; + DEBUG_ExitMode = EXIT_CONTINUE; + ret_ok = FALSE; do { __TRY { ret_ok = TRUE; - if ((ret = yyparse())) { - DEBUG_FlushSymbols(); - } + yyparse(); } __EXCEPT(wine_dbg_cmd) { ret_ok = FALSE; } __ENDTRY; - + DEBUG_FlushSymbols(); } while (!ret_ok); - return ret; } int yyerror(char* s) diff --git a/debugger/debugger.h b/debugger/debugger.h index b766ec66b69..d3a10d964cd 100644 --- a/debugger/debugger.h +++ b/debugger/debugger.h @@ -126,7 +126,6 @@ typedef struct wine_locals WineLocals; enum exec_mode { EXEC_CONT, /* Continuous execution */ - EXEC_PASS, /* Continue, passing exception to app */ EXEC_STEP_OVER, /* Stepping over a call to next source line */ EXEC_STEP_INSTR, /* Step to next source line, stepping in if needed */ EXEC_STEPI_OVER, /* Stepping over a call */ @@ -139,6 +138,19 @@ enum exec_mode */ }; +enum dbg_mode +{ + MODE_INVALID, MODE_16, MODE_32, MODE_VM86 +}; + +enum exit_mode /* of exception handling */ +{ + EXIT_CONTINUE, /* continue execution */ + EXIT_PASS, /* pass exception back to app (1st chance) */ + EXIT_DETACH, /* detach debugger */ + EXIT_QUIT, /* exit debugger and kill debuggee */ +}; + #define DBG_BREAK 0 #define DBG_WATCH 1 @@ -165,17 +177,6 @@ typedef struct struct expr * condition; } DBG_BREAKPOINT; -enum dbg_mode -{ - MODE_INVALID, MODE_16, MODE_32, MODE_VM86 -}; - - -enum exit_mode -{ - EXIT_CONT, EXIT_QUIT, EXIT_DETACH -}; - /* Wine extension; Windows doesn't have a name for this code. This is an undocumented exception understood by MS VC debugger, allowing the program to name a particular thread. Search google.com or deja.com for "0x406d1388" @@ -198,9 +199,9 @@ typedef struct tagDBG_THREAD { LPVOID start; LPVOID teb; int wait_for_first_exception; - enum dbg_mode dbg_mode; - enum exec_mode dbg_exec_mode; - int dbg_exec_count; + enum exec_mode exec_mode; /* mode the thread is run (step/run...) */ + int exec_count; /* count of mode operations */ + enum dbg_mode dbg_mode; /* mode (VM86, 32bit, 16bit) */ DBG_BREAKPOINT stepOverBP; char name[9]; struct tagDBG_THREAD* next; @@ -241,6 +242,7 @@ extern DWORD DEBUG_CurrTid; extern DWORD DEBUG_CurrPid; extern CONTEXT DEBUG_context; extern BOOL DEBUG_interactiveP; +extern enum exit_mode DEBUG_ExitMode; #define DEBUG_READ_MEM(addr, buf, len) \ (ReadProcessMemory(DEBUG_CurrProcess->handle, (addr), (buf), (len), NULL)) @@ -294,10 +296,9 @@ extern void DEBUG_DelBreakpoint( int num ); extern void DEBUG_EnableBreakpoint( int num, BOOL enable ); extern void DEBUG_InfoBreakpoints(void); extern BOOL DEBUG_HandleTrap(void); -extern BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, - int * count ); +extern BOOL DEBUG_ShouldContinue( DBG_ADDR* addr, DWORD code, int* count ); extern void DEBUG_SuspendExecution( void ); -extern enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ); +extern void DEBUG_RestartExecution( int count ); extern BOOL DEBUG_IsFctReturn(void); extern int DEBUG_AddBPCondition(int bpnum, struct expr * exp); @@ -305,7 +306,7 @@ extern int DEBUG_AddBPCondition(int bpnum, struct expr * exp); extern void DEBUG_Disasm( DBG_ADDR *addr, int display ); /* debugger/dbg.y */ -extern enum exit_mode DEBUG_Parser(void); +extern void DEBUG_Parser(void); extern void DEBUG_Exit( DWORD ); /* debugger/debug.l */ diff --git a/debugger/winedbg.c b/debugger/winedbg.c index 5ea7013bf89..26b29111deb 100644 --- a/debugger/winedbg.c +++ b/debugger/winedbg.c @@ -40,6 +40,7 @@ DWORD DEBUG_CurrTid; DWORD DEBUG_CurrPid; CONTEXT DEBUG_context; BOOL DEBUG_interactiveP = FALSE; +enum exit_mode DEBUG_ExitMode = EXIT_CONTINUE; int curr_frame = 0; static char* DEBUG_LastCmdLine = NULL; @@ -242,8 +243,9 @@ static DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid, t->teb = teb; t->process = p; t->wait_for_first_exception = 0; - t->dbg_exec_mode = EXEC_CONT; - t->dbg_exec_count = 0; + t->exec_mode = EXEC_CONT; + t->exec_count = 0; + sprintf(t->name, "%08lx", tid); p->num_threads++; @@ -349,10 +351,8 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code) DEBUG_LoadEntryPoints("Loading new modules symbols:\n"); if (!force && is_debug && - DEBUG_ShouldContinue(&addr, - code, - DEBUG_CurrThread->dbg_exec_mode, - &DEBUG_CurrThread->dbg_exec_count)) + DEBUG_ShouldContinue(&addr, code, + &DEBUG_CurrThread->exec_count)) return FALSE; if ((newmode = DEBUG_GetSelectorType(addr.seg)) == MODE_INVALID) newmode = MODE_32; @@ -387,8 +387,8 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code) } if (!is_debug || - (DEBUG_CurrThread->dbg_exec_mode == EXEC_STEPI_OVER) || - (DEBUG_CurrThread->dbg_exec_mode == EXEC_STEPI_INSTR)) { + (DEBUG_CurrThread->exec_mode == EXEC_STEPI_OVER) || + (DEBUG_CurrThread->exec_mode == EXEC_STEPI_INSTR)) { struct list_id list; @@ -403,30 +403,27 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code) return TRUE; } -static DWORD DEBUG_ExceptionEpilog(void) +static void DEBUG_ExceptionEpilog(void) { - DEBUG_CurrThread->dbg_exec_mode = DEBUG_RestartExecution(DEBUG_CurrThread->dbg_exec_mode, - DEBUG_CurrThread->dbg_exec_count); + DEBUG_RestartExecution(DEBUG_CurrThread->exec_count); /* * This will have gotten absorbed into the breakpoint info * if it was used. Otherwise it would have been ignored. * In any case, we don't mess with it any more. */ - if (DEBUG_CurrThread->dbg_exec_mode == EXEC_CONT || DEBUG_CurrThread->dbg_exec_mode == EXEC_PASS) - DEBUG_CurrThread->dbg_exec_count = 0; - - return (DEBUG_CurrThread->dbg_exec_mode == EXEC_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE; + if (DEBUG_CurrThread->exec_mode == EXEC_CONT) + DEBUG_CurrThread->exec_count = 0; } -static enum exit_mode DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL force, LPDWORD cont) +static void DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL force) { BOOL is_debug = FALSE; - enum exit_mode ret = EXIT_CONT; THREADNAME_INFO *pThreadName; DBG_THREAD *pThread; + assert(DEBUG_CurrThread); - *cont = DBG_CONTINUE; + DEBUG_ExitMode = EXIT_CONTINUE; switch (rec->ExceptionCode) { @@ -446,14 +443,14 @@ static enum exit_mode DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_ch DEBUG_Printf (DBG_CHN_MESG, "Thread ID=0x%lx renamed using MS VC6 extension (name==\"%s\")\n", pThread->tid, pThread->name); - return EXIT_CONT; + return; } if (first_chance && !is_debug && !force && !DBG_IVAR(BreakOnFirstChance)) { /* pass exception to program except for debug exceptions */ - *cont = is_debug ? DBG_CONTINUE : DBG_EXCEPTION_NOT_HANDLED; - return EXIT_CONT; + if (!is_debug) DEBUG_ExitMode = EXIT_PASS; + return; } if (!is_debug) @@ -511,7 +508,7 @@ static enum exit_mode DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_ch if (!DBG_IVAR(BreakOnCritSectTimeOut)) { DEBUG_Printf(DBG_CHN_MESG, "\n"); - return EXIT_CONT; + return; } break; case EXCEPTION_WINE_STUB: @@ -548,27 +545,32 @@ static enum exit_mode DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_ch #else 0L, 0L, #endif - DEBUG_CurrThread->dbg_exec_mode, DEBUG_CurrThread->dbg_exec_count); + DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count); #endif if (automatic_mode) { DEBUG_ExceptionProlog(is_debug, FALSE, rec->ExceptionCode); - return EXIT_QUIT; /* terminate execution */ + DEBUG_ExitMode = EXIT_QUIT; + return; /* terminate execution */ } if (DEBUG_ExceptionProlog(is_debug, force, rec->ExceptionCode)) { DEBUG_interactiveP = TRUE; - while ((ret = DEBUG_Parser()) == EXIT_CONT) { + for (;;) + { + DEBUG_Parser(); + if (DEBUG_ExitMode == EXIT_QUIT || DEBUG_ExitMode == EXIT_DETACH) + break; if (DEBUG_ValidateRegisters()) { - if (DEBUG_CurrThread->dbg_exec_mode != EXEC_PASS || first_chance) + if (DEBUG_ExitMode == EXIT_PASS || first_chance) break; DEBUG_Printf(DBG_CHN_MESG, "Cannot pass on last chance exception. You must use cont\n"); } } DEBUG_interactiveP = FALSE; } - *cont = DEBUG_ExceptionEpilog(); + DEBUG_ExceptionEpilog(); #if 0 DEBUG_Printf(DBG_CHN_TRACE, @@ -578,24 +580,19 @@ static enum exit_mode DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_ch #else 0L, 0L, #endif - DEBUG_CurrThread->dbg_exec_mode, DEBUG_CurrThread->dbg_exec_count); + DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count); #endif - - return ret; } -static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont) +static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de) { char buffer[256]; - enum exit_mode ret; DEBUG_CurrPid = de->dwProcessId; DEBUG_CurrTid = de->dwThreadId; + DEBUG_ExitMode = EXIT_CONTINUE; __TRY { - ret = EXIT_CONT; - *cont = 0L; - if ((DEBUG_CurrProcess = DEBUG_GetProcess(de->dwProcessId)) != NULL) DEBUG_CurrThread = DEBUG_GetThread(DEBUG_CurrProcess, de->dwThreadId); else @@ -616,7 +613,6 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont) if (DEBUG_CurrProcess->continue_on_first_exception) { DEBUG_CurrProcess->continue_on_first_exception = FALSE; if (!DBG_IVAR(BreakOnAttach)) { - *cont = DBG_CONTINUE; break; } } @@ -636,10 +632,9 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont) break; } - ret = DEBUG_HandleException(&de->u.Exception.ExceptionRecord, - de->u.Exception.dwFirstChance, - DEBUG_CurrThread->wait_for_first_exception, - cont); + DEBUG_HandleException(&de->u.Exception.ExceptionRecord, + de->u.Exception.dwFirstChance, + DEBUG_CurrThread->wait_for_first_exception); if (DEBUG_CurrThread) { DEBUG_CurrThread->wait_for_first_exception = 0; SetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context); @@ -793,7 +788,7 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont) if (DBG_IVAR(BreakOnDllLoad)) { DEBUG_Printf(DBG_CHN_MESG, "Stopping on DLL %s loading at %08lx\n", buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll); - ret = DEBUG_Parser(); + DEBUG_Parser(); } break; @@ -829,38 +824,42 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont) } } __EXCEPT(wine_dbg) { - *cont = 0; - ret = EXIT_CONT; + DEBUG_ExitMode = EXIT_CONTINUE; } __ENDTRY; - return ret; } static DWORD DEBUG_MainLoop(void) { DEBUG_EVENT de; - DWORD cont; - enum exit_mode ret = EXIT_CONT; DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid); - while (ret == EXIT_CONT) + while (DEBUG_ExitMode == EXIT_CONTINUE) { /* wait until we get at least one loaded process */ - while (!DEBUG_ProcessList && (ret = DEBUG_Parser()) == EXIT_CONT); - if (ret != EXIT_CONT) break; - - while (ret == EXIT_CONT && DEBUG_ProcessList && WaitForDebugEvent(&de, INFINITE)) { - ret = DEBUG_HandleDebugEvent(&de, &cont); - ContinueDebugEvent(de.dwProcessId, de.dwThreadId, cont); - } - if (ret == EXIT_DETACH && DEBUG_Detach()) + while (!DEBUG_ProcessList) { - /* ret = EXIT_CONT; */ + DEBUG_Parser(); + if (DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_QUIT) break; + } + if (DEBUG_ExitMode != EXIT_CONTINUE) break; + + while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) && + DEBUG_ProcessList && + WaitForDebugEvent(&de, INFINITE)) + { + DEBUG_HandleDebugEvent(&de); + ContinueDebugEvent(de.dwProcessId, de.dwThreadId, + (DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE); + } + if (DEBUG_ExitMode == EXIT_DETACH && DEBUG_Detach()) + { + /* DEBUG_ExitMode = EXIT_CONTINUE; */ /* FIXME: as we don't have a simple way to zero out the process symbol table * we simply quit the debugger on detach... */ - ret = EXIT_QUIT; + DEBUG_ExitMode = EXIT_QUIT; } } @@ -872,15 +871,16 @@ static DWORD DEBUG_MainLoop(void) static DWORD DEBUG_AutoMode(void) { DEBUG_EVENT de; - DWORD cont; - enum exit_mode ret = EXIT_CONT; DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid); - while (ret == EXIT_CONT && DEBUG_ProcessList && WaitForDebugEvent(&de, INFINITE)) + while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) && + DEBUG_ProcessList && + WaitForDebugEvent(&de, INFINITE)) { - ret = DEBUG_HandleDebugEvent(&de, &cont); - ContinueDebugEvent(de.dwProcessId, de.dwThreadId, cont); + DEBUG_HandleDebugEvent(&de); + ContinueDebugEvent(de.dwProcessId, de.dwThreadId, + (DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE); } /* print some extra information */ DEBUG_Printf(DBG_CHN_MESG, "Modules:\n");