Commit 40912b90 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Inverted inner loops (Win32 debug event handling / WineDbg command

line parser).
parent 57807fa1
...@@ -836,8 +836,8 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count ) ...@@ -836,8 +836,8 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
*/ */
if (mode != EXEC_CONT && mode != EXEC_FINISH) if (mode != EXEC_CONT && mode != EXEC_FINISH)
{ {
DEBUG_FindNearestSymbol( addr, TRUE, NULL, 0, &syminfo.list); DEBUG_FindNearestSymbol(addr, TRUE, NULL, 0, &syminfo.list);
if( syminfo.list.sourcefile != NULL ) if (syminfo.list.sourcefile != NULL)
{ {
DEBUG_List(&syminfo.list, NULL, 0); DEBUG_List(&syminfo.list, NULL, 0);
} }
...@@ -847,8 +847,8 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count ) ...@@ -847,8 +847,8 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
/* If there's no breakpoint and we are not single-stepping, then /* If there's no breakpoint and we are not single-stepping, then
* either we must have encountered an int3 in the Windows program * either we must have encountered an int3 in the Windows program
* or someone is trying to stop us * or someone is trying to stop us
* If the later, (no int3 opcode at current address) then stop, * If the later, (no int3 opcode at current address) then stop,
* otherwise, let's skip it. * otherwise, let's skip it.
*/ */
if ((bpnum == -1) && code == EXCEPTION_BREAKPOINT) if ((bpnum == -1) && code == EXCEPTION_BREAKPOINT)
{ {
......
...@@ -105,30 +105,21 @@ line: command ...@@ -105,30 +105,21 @@ line: command
; ;
command: command:
tQUIT tEOL { DEBUG_ExitMode = EXIT_QUIT; return 1; } tQUIT tEOL { /*DEBUG_Quit();*/ return 1; }
| tHELP tEOL { DEBUG_Help(); } | tHELP tEOL { DEBUG_Help(); }
| tHELP tINFO tEOL { DEBUG_HelpInfo(); } | tHELP tINFO tEOL { DEBUG_HelpInfo(); }
| tCONT tEOL { DEBUG_CurrThread->exec_count = 1; | tPASS tEOL { DEBUG_WaitNextException(DBG_EXCEPTION_NOT_HANDLED, 0, 0); }
DEBUG_CurrThread->exec_mode = EXEC_CONT; return 1; } | tCONT tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_CONT); }
| tPASS tEOL { DEBUG_ExitMode = EXIT_PASS; return 1; } | tCONT tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_CONT); }
| tCONT tNUM tEOL { DEBUG_CurrThread->exec_count = $2; | tSTEP tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_STEP_INSTR); }
DEBUG_CurrThread->exec_mode = EXEC_CONT; return 1; } | tSTEP tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_STEP_INSTR); }
| tSTEP tEOL { DEBUG_CurrThread->exec_count = 1; | tNEXT tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_STEP_OVER); }
DEBUG_CurrThread->exec_mode = EXEC_STEP_INSTR; return 1; } | tNEXT tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_STEP_OVER); }
| tNEXT tEOL { DEBUG_CurrThread->exec_count = 1; | tSTEPI tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_STEPI_INSTR); }
DEBUG_CurrThread->exec_mode = EXEC_STEP_OVER; return 1; } | tSTEPI tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_STEPI_INSTR); }
| tSTEP tNUM tEOL { DEBUG_CurrThread->exec_count = $2; | tNEXTI tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 1, EXEC_STEPI_OVER); }
DEBUG_CurrThread->exec_mode = EXEC_STEP_INSTR; return 1; } | tNEXTI tNUM tEOL { DEBUG_WaitNextException(DBG_CONTINUE, $2, EXEC_STEPI_OVER); }
| tNEXT tNUM tEOL { DEBUG_CurrThread->exec_count = $2; | tFINISH tEOL { DEBUG_WaitNextException(DBG_CONTINUE, 0, EXEC_FINISH); }
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); } | tABORT tEOL { kill(getpid(), SIGABRT); }
| tMODE tNUM tEOL { mode_command($2); } | tMODE tNUM tEOL { mode_command($2); }
| tMODE tVM86 tEOL { DEBUG_CurrThread->dbg_mode = MODE_VM86; } | tMODE tVM86 tEOL { DEBUG_CurrThread->dbg_mode = MODE_VM86; }
...@@ -142,8 +133,6 @@ command: ...@@ -142,8 +133,6 @@ command:
| tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); } | tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); }
| tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); } | tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); }
| tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); } | tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); }
| tFINISH tEOL { DEBUG_CurrThread->exec_count = 0;
DEBUG_CurrThread->exec_mode = EXEC_FINISH; return 1; }
| tSHOW tDIR tEOL { DEBUG_ShowDir(); } | tSHOW tDIR tEOL { DEBUG_ShowDir(); }
| tDIR pathname tEOL { DEBUG_AddPath( $2 ); } | tDIR pathname tEOL { DEBUG_AddPath( $2 ); }
| tDIR tEOL { DEBUG_NukePath(); } | tDIR tEOL { DEBUG_NukePath(); }
...@@ -158,8 +147,8 @@ command: ...@@ -158,8 +147,8 @@ command:
| tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); } | tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); }
| tSYMBOLFILE pathname tEOL { DEBUG_ReadSymbolTable($2); } | tSYMBOLFILE pathname tEOL { DEBUG_ReadSymbolTable($2); }
| tWHATIS expr_addr tEOL { DEBUG_PrintType(&$2); DEBUG_FreeExprMem(); } | tWHATIS expr_addr tEOL { DEBUG_PrintType(&$2); DEBUG_FreeExprMem(); }
| tATTACH tNUM tEOL { if (DEBUG_Attach($2, FALSE)) return 1; } | tATTACH tNUM tEOL { DEBUG_Attach($2, FALSE); }
| tDETACH tEOL { DEBUG_ExitMode = EXIT_DETACH; return 1; } | tDETACH tEOL { return DEBUG_Detach(); /* FIXME: we shouldn't return, but since we cannot simply clean the symbol table, exit debugger for now */ }
| list_command | list_command
| disassemble_command | disassemble_command
| set_command | set_command
...@@ -173,7 +162,7 @@ command: ...@@ -173,7 +162,7 @@ command:
| noprocess_state | noprocess_state
; ;
set_command: set_command:
tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory(&$2,$4); DEBUG_FreeExprMem(); } tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory(&$2,$4); DEBUG_FreeExprMem(); }
| tSET '+' tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, NULL, $3);} | tSET '+' tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, NULL, $3);}
| tSET '-' tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, NULL, $3);} | tSET '-' tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, NULL, $3);}
...@@ -415,6 +404,7 @@ static WINE_EXCEPTION_FILTER(wine_dbg_cmd) ...@@ -415,6 +404,7 @@ static WINE_EXCEPTION_FILTER(wine_dbg_cmd)
break; break;
default: default:
DEBUG_Printf(DBG_CHN_MESG, "Exception %lx\n", GetExceptionCode()); DEBUG_Printf(DBG_CHN_MESG, "Exception %lx\n", GetExceptionCode());
DEBUG_ExternalDebugger();
break; break;
} }
...@@ -434,8 +424,6 @@ void DEBUG_Parser(void) ...@@ -434,8 +424,6 @@ void DEBUG_Parser(void)
#endif #endif
yyin = stdin; yyin = stdin;
DEBUG_ExitMode = EXIT_CONTINUE;
ret_ok = FALSE; ret_ok = FALSE;
do { do {
__TRY { __TRY {
......
...@@ -241,7 +241,7 @@ extern DBG_THREAD* DEBUG_CurrThread; ...@@ -241,7 +241,7 @@ extern DBG_THREAD* DEBUG_CurrThread;
extern DWORD DEBUG_CurrTid; extern DWORD DEBUG_CurrTid;
extern DWORD DEBUG_CurrPid; extern DWORD DEBUG_CurrPid;
extern CONTEXT DEBUG_context; extern CONTEXT DEBUG_context;
extern BOOL DEBUG_interactiveP; extern BOOL DEBUG_InteractiveP;
extern enum exit_mode DEBUG_ExitMode; extern enum exit_mode DEBUG_ExitMode;
#define DEBUG_READ_MEM(addr, buf, len) \ #define DEBUG_READ_MEM(addr, buf, len) \
...@@ -516,21 +516,30 @@ extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic); ...@@ -516,21 +516,30 @@ extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
#define DBG_CHN_WARN 4 #define DBG_CHN_WARN 4
#define DBG_CHN_FIXME 8 #define DBG_CHN_FIXME 8
#define DBG_CHN_TRACE 16 #define DBG_CHN_TRACE 16
extern void DEBUG_OutputA(int chn, const char* buffer, int len); extern void DEBUG_OutputA(int chn, const char* buffer, int len);
extern void DEBUG_OutputW(int chn, const WCHAR* buffer, int len); extern void DEBUG_OutputW(int chn, const WCHAR* buffer, int len);
#ifdef __GNUC__ #ifdef __GNUC__
extern int DEBUG_Printf(int chn, const char* format, ...) __attribute__((format (printf,2,3))); extern int DEBUG_Printf(int chn, const char* format, ...) __attribute__((format (printf,2,3)));
#else #else
extern int DEBUG_Printf(int chn, const char* format, ...); extern int DEBUG_Printf(int chn, const char* format, ...);
#endif #endif
extern DBG_INTVAR* DEBUG_GetIntVar(const char*); extern DBG_INTVAR* DEBUG_GetIntVar(const char*);
extern BOOL DEBUG_Attach(DWORD pid, BOOL cofe); extern BOOL DEBUG_Attach(DWORD pid, BOOL cofe);
extern BOOL DEBUG_Detach(void); extern BOOL DEBUG_Detach(void);
extern void DEBUG_Run(const char* args); extern void DEBUG_Run(const char* args);
extern DBG_PROCESS* DEBUG_AddProcess(DWORD pid, HANDLE h, const char* imageName);
extern DBG_PROCESS* DEBUG_GetProcess(DWORD pid); extern DBG_PROCESS* DEBUG_GetProcess(DWORD pid);
extern void DEBUG_DelProcess(DBG_PROCESS* p);
extern DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid, HANDLE h, LPVOID start, LPVOID teb);
extern DBG_THREAD* DEBUG_GetThread(DBG_PROCESS* p, DWORD tid); extern DBG_THREAD* DEBUG_GetThread(DBG_PROCESS* p, DWORD tid);
extern void DEBUG_DelThread(DBG_THREAD* t);
extern BOOL DEBUG_ProcessGetString(char* buffer, int size, HANDLE hp, LPSTR addr);
extern BOOL DEBUG_ProcessGetStringIndirect(char* buffer, int size, HANDLE hp, LPVOID addr);
extern void DEBUG_WaitNextException(DWORD cont, int count, int mode);
extern int curr_frame; extern int curr_frame;
extern int automatic_mode;
/* gdbproxy.c */
extern BOOL DEBUG_GdbRemote(unsigned int);
/* Choose your allocator! */ /* Choose your allocator! */
#if 1 #if 1
......
...@@ -399,7 +399,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno, ...@@ -399,7 +399,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
if (num == 0) { if (num == 0) {
return FALSE; return FALSE;
} else if (!DEBUG_interactiveP || num == 1) { } else if (!DEBUG_InteractiveP || num == 1) {
i = 0; i = 0;
} else { } else {
char buffer[256]; char buffer[256];
......
...@@ -196,7 +196,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end) ...@@ -196,7 +196,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
if( sl == NULL ) if( sl == NULL )
{ {
if (!automatic_mode) if (DEBUG_InteractiveP)
{ {
char zbuf[256]; char zbuf[256];
/* /*
...@@ -495,4 +495,3 @@ DEBUG_Disassemble(const DBG_VALUE *xstart,const DBG_VALUE *xend,int offset) ...@@ -495,4 +495,3 @@ DEBUG_Disassemble(const DBG_VALUE *xstart,const DBG_VALUE *xend,int offset)
DEBUG_LastDisassemble = last; DEBUG_LastDisassemble = last;
return; return;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment