3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
7 * Copyright 2000 Eric Pouech
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/exception.h"
37 static void mode_command
(int);
48 struct list_id listing
;
49 struct expr
* expression
;
50 struct datatype
* type
;
53 %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
54 %token tENABLE tDISABLE tBREAK tWATCH tDELETE tSET tMODE tPRINT tEXAM tABORT tVM86
55 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tSYMBOL tREGS tWND tLOCAL tEXCEPTION
56 %token tPROCESS tTHREAD tEOL tEOF
57 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tSYMBOL tREGS tWND tQUEUE tLOCAL tEXCEPTION
58 %token tPROCESS tTHREAD tMODREF tEOL tEOF
59 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
60 %token tSTEPI tNEXTI tFINISH tSHOW tDIR tWHATIS tSOURCE
62 %token
<string> tIDENTIFIER tSTRING tDEBUGSTR tINTVAR
63 %token
<integer
> tNUM tFORMAT
64 %token tSYMBOLFILE tRUN tATTACH tDETACH tNOPROCESS
66 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
67 %token tSTRUCT tUNION tENUM
70 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
71 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
72 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
73 /* %left OP_COND */ /* ... ? ... : ... */
80 %left
'<' '>' OP_LE OP_GE
84 %left OP_SIGN
'!' '~' OP_DEREF
/* OP_INC OP_DEC OP_ADDR */
88 %type
<expression
> expr lval lvalue
89 %type
<type
> type_expr
90 %type
<value
> expr_addr lval_addr
91 %type
<integer
> expr_value
92 %type
<string> pathname identifier
94 %type
<listing
> list_arg
102 line: command
{ DEBUG_FreeExprMem
(); }
105 |
error tEOL
{ yyerrok; DEBUG_FreeExprMem
(); }
109 tQUIT tEOL
{ /*DEBUG_Quit();*/ return
1; }
110 | tHELP tEOL
{ DEBUG_Help
(); }
111 | tHELP tINFO tEOL
{ DEBUG_HelpInfo
(); }
112 | tPASS tEOL
{ DEBUG_WaitNextException
(DBG_EXCEPTION_NOT_HANDLED
, 0, 0); }
113 | tCONT tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 1, EXEC_CONT
); }
114 | tCONT tNUM tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, $2, EXEC_CONT
); }
115 | tSTEP tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 1, EXEC_STEP_INSTR
); }
116 | tSTEP tNUM tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, $2, EXEC_STEP_INSTR
); }
117 | tNEXT tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 1, EXEC_STEP_OVER
); }
118 | tNEXT tNUM tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, $2, EXEC_STEP_OVER
); }
119 | tSTEPI tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 1, EXEC_STEPI_INSTR
); }
120 | tSTEPI tNUM tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, $2, EXEC_STEPI_INSTR
); }
121 | tNEXTI tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 1, EXEC_STEPI_OVER
); }
122 | tNEXTI tNUM tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, $2, EXEC_STEPI_OVER
); }
123 | tFINISH tEOL
{ DEBUG_WaitNextException
(DBG_CONTINUE
, 0, EXEC_FINISH
); }
124 | tABORT tEOL
{ abort
(); }
125 | tMODE tNUM tEOL
{ mode_command
($2); }
126 | tMODE tVM86 tEOL
{ DEBUG_CurrThread
->dbg_mode
= MODE_VM86
; }
127 | tENABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, TRUE
); }
128 | tDISABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, FALSE
); }
129 | tDELETE tBREAK tNUM tEOL
{ DEBUG_DelBreakpoint
( $3 ); }
130 | tBACKTRACE tEOL
{ DEBUG_BackTrace
(DEBUG_CurrTid
, TRUE
); }
131 | tBACKTRACE tNUM tEOL
{ DEBUG_BackTrace
($2, TRUE
); }
132 | tUP tEOL
{ DEBUG_SetFrame
( curr_frame
+ 1 ); }
133 | tUP tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
+ $2 ); }
134 | tDOWN tEOL
{ DEBUG_SetFrame
( curr_frame
- 1 ); }
135 | tDOWN tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
- $2 ); }
136 | tFRAME tNUM tEOL
{ DEBUG_SetFrame
( $2 ); }
137 | tSHOW tDIR tEOL
{ DEBUG_ShowDir
(); }
138 | tDIR pathname tEOL
{ DEBUG_AddPath
( $2 ); }
139 | tDIR tEOL
{ DEBUG_NukePath
(); }
140 | tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
141 | tDISPLAY expr tEOL
{ DEBUG_AddDisplay
($2, 1, 0); }
142 | tDISPLAY tFORMAT expr tEOL
{ DEBUG_AddDisplay
($3, $2 >> 8, $2 & 0xff); }
143 | tDELETE tDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $3 ); }
144 | tDELETE tDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
145 | tUNDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $2 ); }
146 | tUNDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
147 | tCOND tNUM tEOL
{ DEBUG_AddBPCondition
($2, NULL
); }
148 | tCOND tNUM expr tEOL
{ DEBUG_AddBPCondition
($2, $3); }
149 | tSOURCE pathname tEOL
{ DEBUG_Parser
($2); }
150 | tSYMBOLFILE pathname tEOL
{ DEBUG_ReadSymbolTable
($2, 0); }
151 | tSYMBOLFILE pathname expr_value tEOL
{ DEBUG_ReadSymbolTable
($2, $3); }
152 | tWHATIS expr_addr tEOL
{ DEBUG_PrintType
(&$2); }
153 | tATTACH tNUM tEOL
{ DEBUG_Attach
($2, FALSE
, TRUE
); }
154 | tDETACH tEOL
{ return DEBUG_Detach
(); /* FIXME: we shouldn't return, but since we cannot simply clean the symbol table, exit debugger for now */ }
156 | disassemble_command
169 tSET lval_addr
'=' expr_value tEOL
{ DEBUG_WriteMemory
(&$2, $4); }
170 | tSET
'+' tIDENTIFIER tEOL
{ DEBUG_DbgChannel
(TRUE
, NULL
, $3); }
171 | tSET
'-' tIDENTIFIER tEOL
{ DEBUG_DbgChannel
(FALSE
, NULL
, $3); }
172 | tSET tIDENTIFIER
'+' tIDENTIFIER tEOL
{ DEBUG_DbgChannel
(TRUE
, $2, $4); }
173 | tSET tIDENTIFIER
'-' tIDENTIFIER tEOL
{ DEBUG_DbgChannel
(FALSE
, $2, $4); }
177 tIDENTIFIER
{ $$
= $1; }
182 tDISASSEMBLE tEOL
{ DEBUG_Disassemble
( NULL
, NULL
, 10 ); }
183 | tDISASSEMBLE expr_addr tEOL
{ DEBUG_Disassemble
( & $2, NULL
, 10 ); }
184 | tDISASSEMBLE expr_addr
',' expr_addr tEOL
{ DEBUG_Disassemble
( & $2, & $4, 0 ); }
188 tLIST tEOL
{ DEBUG_List
( NULL
, NULL
, 10 ); }
189 | tLIST
'-' tEOL
{ DEBUG_List
( NULL
, NULL
, -10 ); }
190 | tLIST list_arg tEOL
{ DEBUG_List
( & $2, NULL
, 10 ); }
191 | tLIST
',' list_arg tEOL
{ DEBUG_List
( NULL
, & $3, -10 ); }
192 | tLIST list_arg
',' list_arg tEOL
{ DEBUG_List
( & $2, & $4, 0 ); }
196 tNUM
{ $$.sourcefile
= NULL
; $$.line
= $1; }
197 | pathname
':' tNUM
{ $$.sourcefile
= $1; $$.line
= $3; }
198 | tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, NULL
, $1); }
199 | pathname
':' tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, $1, $3); }
200 |
'*' expr_addr
{ DEBUG_FindNearestSymbol
( & $2.addr
, FALSE
, NULL
, 0, & $$
); }
204 tEXAM expr_addr tEOL
{ DEBUG_ExamineMemory
( &$2, 1, 'x'); }
205 | tEXAM tFORMAT expr_addr tEOL
{ DEBUG_ExamineMemory
( &$3, $2>>8, $2&0xff ); }
209 tPRINT expr_addr tEOL
{ DEBUG_Print
( &$2, 1, 0, 0 ); }
210 | tPRINT tFORMAT expr_addr tEOL
{ DEBUG_Print
( &$3, $2 >> 8, $2 & 0xff, 0 ); }
214 tBREAK
'*' expr_addr tEOL
{ DEBUG_AddBreakpointFromValue
( &$3 ); }
215 | tBREAK identifier tEOL
{ DEBUG_AddBreakpointFromId
($2, -1); }
216 | tBREAK identifier
':' tNUM tEOL
{ DEBUG_AddBreakpointFromId
($2, $4); }
217 | tBREAK tNUM tEOL
{ DEBUG_AddBreakpointFromLineno
($2); }
218 | tBREAK tEOL
{ DEBUG_AddBreakpointFromLineno
(-1); }
222 tWATCH
'*' expr_addr tEOL
{ DEBUG_AddWatchpoint
( &$3, 1 ); }
223 | tWATCH identifier tEOL
{ DEBUG_AddWatchpointFromId
($2); }
227 tINFO tBREAK tEOL
{ DEBUG_InfoBreakpoints
(); }
228 | tINFO tCLASS tSTRING tEOL
{ DEBUG_InfoClass
( $3 ); }
229 | tINFO tSHARE tEOL
{ DEBUG_InfoShare
(); }
230 | tINFO tMODULE expr_value tEOL
{ DEBUG_DumpModule
( $3 ); }
231 | tINFO tREGS tEOL
{ DEBUG_InfoRegisters
(&DEBUG_context
); }
232 | tINFO tSEGMENTS expr_value tEOL
{ DEBUG_InfoSegments
( $3, 1 ); }
233 | tINFO tSEGMENTS tEOL
{ DEBUG_InfoSegments
( 0, -1 ); }
234 | tINFO tSTACK tEOL
{ DEBUG_InfoStack
(); }
235 | tINFO tSYMBOL tSTRING tEOL
{ DEBUG_InfoSymbols
($3); }
236 | tINFO tWND expr_value tEOL
{ DEBUG_InfoWindow
( (HWND
)$3 ); }
237 | tINFO tLOCAL tEOL
{ DEBUG_InfoLocals
(); }
238 | tINFO tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
242 tWALK tCLASS tEOL
{ DEBUG_WalkClasses
(); }
243 | tWALK tMODULE tEOL
{ DEBUG_WalkModules
(); }
244 | tWALK tWND tEOL
{ DEBUG_WalkWindows
( 0, 0 ); }
245 | tWALK tWND expr_value tEOL
{ DEBUG_WalkWindows
( (HWND
)$3, 0 ); }
246 | tWALK tMAPS tEOL
{ DEBUG_InfoVirtual
(0); }
247 | tWALK tMAPS expr_value tEOL
{ DEBUG_InfoVirtual
($3); }
248 | tWALK tPROCESS tEOL
{ DEBUG_WalkProcess
(); }
249 | tWALK tTHREAD tEOL
{ DEBUG_WalkThreads
(); }
250 | tWALK tEXCEPTION tEOL
{ DEBUG_WalkExceptions
(DEBUG_CurrTid
); }
251 | tWALK tEXCEPTION expr_value tEOL
{ DEBUG_WalkExceptions
($3); }
255 tRUN tEOL
{ DEBUG_Run
(NULL
); }
256 | tRUN tSTRING tEOL
{ DEBUG_Run
($2); }
260 tNOPROCESS tEOL
{} /* <CR> shall not barf anything */
261 | tNOPROCESS tSTRING tEOL
{ DEBUG_Printf
(DBG_CHN_MESG
, "No process loaded, cannot execute '%s'\n", $2); }
265 type_expr
'*' { $$
= $1 ? DEBUG_FindOrMakePointerType
($1) : NULL
; }
266 | tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_INT
); }
267 | tCHAR
{ $$
= DEBUG_GetBasicType
(DT_BASIC_CHAR
); }
268 | tLONG tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_LONGINT
); }
269 | tUNSIGNED tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_UINT
); }
270 | tLONG tUNSIGNED tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_ULONGINT
); }
271 | tLONG tLONG tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_LONGLONGINT
); }
272 | tLONG tLONG tUNSIGNED tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_ULONGLONGINT
); }
273 | tSHORT tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_SHORTINT
); }
274 | tSHORT tUNSIGNED tINT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_USHORTINT
); }
275 | tSIGNED tCHAR
{ $$
= DEBUG_GetBasicType
(DT_BASIC_SCHAR
); }
276 | tUNSIGNED tCHAR
{ $$
= DEBUG_GetBasicType
(DT_BASIC_UCHAR
); }
277 | tFLOAT
{ $$
= DEBUG_GetBasicType
(DT_BASIC_FLOAT
); }
278 | tDOUBLE
{ $$
= DEBUG_GetBasicType
(DT_BASIC_DOUBLE
); }
279 | tLONG tDOUBLE
{ $$
= DEBUG_GetBasicType
(DT_BASIC_LONGDOUBLE
); }
280 | tSTRUCT tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
281 | tUNION tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
282 | tENUM tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_ENUM
, $2); }
285 expr_addr: expr
{ $$
= DEBUG_EvalExpr
($1); }
288 expr_value: expr
{ DBG_VALUE value
= DEBUG_EvalExpr
($1);
289 /* expr_value is typed as an integer */
290 $$
= DEBUG_ReadMemory
(&value
); }
294 * The expr rule builds an expression tree. When we are done, we call
295 * EvalExpr to evaluate the value of the expression. The advantage of
296 * the two-step approach is that it is possible to save expressions for
297 * use in 'display' commands, and in conditional watchpoints.
300 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
301 | tSTRING
{ $$
= DEBUG_StringExpr
($1); }
302 | tINTVAR
{ $$
= DEBUG_IntVarExpr
($1); }
303 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
304 | expr OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
305 | expr
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
306 | tIDENTIFIER
'(' ')' { $$
= DEBUG_CallExpr
($1, 0); }
307 | tIDENTIFIER
'(' expr
')' { $$
= DEBUG_CallExpr
($1, 1, $3); }
308 | tIDENTIFIER
'(' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 2, $3, $5); }
309 | tIDENTIFIER
'(' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7); }
310 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 4, $3, $5, $7, $9); }
311 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 5, $3, $5, $7, $9, $11); }
312 | expr
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
313 | expr
':' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SEG
, $1, $3); }
314 | expr OP_LOR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LOR
, $1, $3); }
315 | expr OP_LAND expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LAND
, $1, $3); }
316 | expr
'|' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_OR
, $1, $3); }
317 | expr
'&' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_AND
, $1, $3); }
318 | expr
'^' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_XOR
, $1, $3); }
319 | expr OP_EQ expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_EQ
, $1, $3); }
320 | expr
'>' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GT
, $1, $3); }
321 | expr
'<' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LT
, $1, $3); }
322 | expr OP_GE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GE
, $1, $3); }
323 | expr OP_LE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LE
, $1, $3); }
324 | expr OP_NE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_NE
, $1, $3); }
325 | expr OP_SHL expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHL
, $1, $3); }
326 | expr OP_SHR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHR
, $1, $3); }
327 | expr
'+' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_ADD
, $1, $3); }
328 | expr
'-' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SUB
, $1, $3); }
329 | expr
'*' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_MUL
, $1, $3); }
330 | expr
'/' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_DIV
, $1, $3); }
331 | expr
'%' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_REM
, $1, $3); }
332 |
'-' expr %prec OP_SIGN
{ $$
= DEBUG_UnopExpr
(EXP_OP_NEG
, $2); }
333 |
'+' expr %prec OP_SIGN
{ $$
= $2; }
334 |
'!' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_NOT
, $2); }
335 |
'~' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_LNOT
, $2); }
336 |
'(' expr
')' { $$
= $2; }
337 |
'*' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_DEREF
, $2); }
338 |
'&' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_ADDR
, $2); }
339 |
'(' type_expr
')' expr %prec OP_DEREF
{ $$
= DEBUG_TypeCastExpr
($2, $4); }
343 * The lvalue rule builds an expression tree. This is a limited form
344 * of expression that is suitable to be used as an lvalue.
346 lval_addr: lval
{ $$
= DEBUG_EvalExpr
($1); }
349 lval: lvalue
{ $$
= $1; }
350 |
'*' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_FORCE_DEREF
, $2); }
353 lvalue: tNUM
{ $$
= DEBUG_ConstExpr
($1); }
354 | tINTVAR
{ $$
= DEBUG_IntVarExpr
($1); }
355 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
356 | lvalue OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
357 | lvalue
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
358 | lvalue
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
361 identifier: tIDENTIFIER
{ $$
= $1; }
362 | identifier
'.' tIDENTIFIER
{ char* ptr
= DBG_alloc
(strlen
($1) + 1 + strlen
($3)+ 1);
363 sprintf
(ptr
, "%s.%s", $1, $3); $$
= DEBUG_MakeSymbol
(ptr
);
365 | identifier
':' ':' tIDENTIFIER
{ char* ptr
= DBG_alloc
(strlen
($1) + 2 + strlen
($4) + 1);
366 sprintf
(ptr
, "%s::%s", $1, $4); $$
= DEBUG_MakeSymbol
(ptr
);
372 static void mode_command
(int newmode
)
376 case
16: DEBUG_CurrThread
->dbg_mode
= MODE_16
; break
;
377 case
32: DEBUG_CurrThread
->dbg_mode
= MODE_32
; break
;
378 default
: DEBUG_Printf
(DBG_CHN_MESG
,"Invalid mode (use 16, 32 or vm86)\n");
382 void DEBUG_Exit
(DWORD ec
)
387 static WINE_EXCEPTION_FILTER
(wine_dbg_cmd
)
389 if
(DBG_IVAR
(ExtDbgOnInternalException
))
390 DEBUG_ExternalDebugger
();
391 DEBUG_Printf
(DBG_CHN_MESG
, "\nwine_dbg_cmd: ");
392 switch
(GetExceptionCode
()) {
393 case DEBUG_STATUS_INTERNAL_ERROR
:
394 DEBUG_Printf
(DBG_CHN_MESG
, "WineDbg internal error\n");
395 if
(DBG_IVAR
(ExtDbgOnInternalException
))
396 DEBUG_ExternalDebugger
();
398 case DEBUG_STATUS_NO_SYMBOL
:
399 DEBUG_Printf
(DBG_CHN_MESG
, "Undefined symbol\n");
401 case DEBUG_STATUS_DIV_BY_ZERO
:
402 DEBUG_Printf
(DBG_CHN_MESG
, "Division by zero\n");
404 case DEBUG_STATUS_BAD_TYPE
:
405 DEBUG_Printf
(DBG_CHN_MESG
, "No type or type mismatch\n");
407 case DEBUG_STATUS_NO_FIELD
:
408 DEBUG_Printf
(DBG_CHN_MESG
, "No such field in structure or union\n");
410 case DEBUG_STATUS_ABORT
:
413 /* this is generally sent by a ctrl-c when we run winedbg outside of wineconsole */
414 DEBUG_Printf
(DBG_CHN_MESG
, "Ctrl-C\n");
415 /* stop the debuggee, and continue debugger execution, we will be reintered by the
416 * debug events generated by stopping
418 DEBUG_InterruptDebuggee
();
419 return EXCEPTION_CONTINUE_EXECUTION
;
421 DEBUG_Printf
(DBG_CHN_MESG
, "Exception %lx\n", GetExceptionCode
());
422 DEBUG_ExternalDebugger
();
426 return EXCEPTION_EXECUTE_HANDLER
;
429 static void set_default_channels
(void)
431 DEBUG_hParserOutput
= GetStdHandle
(STD_OUTPUT_HANDLE
);
432 DEBUG_hParserInput
= GetStdHandle
(STD_INPUT_HANDLE
);
435 /***********************************************************************
438 * Debugger command line parser
440 void DEBUG_Parser
(LPCSTR filename
)
451 DEBUG_hParserOutput
= 0;
452 DEBUG_hParserInput
= CreateFile
(filename
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, 0L, 0);
453 if
(DEBUG_hParserInput
== INVALID_HANDLE_VALUE
)
455 set_default_channels
();
460 set_default_channels
();
469 __EXCEPT
(wine_dbg_cmd
)
474 DEBUG_FlushSymbols
();
478 CloseHandle
(DEBUG_hParserInput
);
479 set_default_channels
();
484 DEBUG_Printf
(DBG_CHN_MESG
, "%s\n", s
);