MenuItemFromPoint: rough implementation.
[wine/wine-gecko.git] / debugger / dbg.y
blob71267ceeb20a8181860e76ea59f6310d8e1c751d
1 %{
2 /*
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
24 #include "config.h"
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <signal.h>
30 #include <unistd.h>
32 #include "wine/exception.h"
33 #include "debugger.h"
34 #include "expr.h"
35 #include "msvcrt/excpt.h"
37 extern FILE * yyin;
39 static void mode_command(int);
40 int yylex(void);
41 int yyerror(char *);
45 %union
47 DBG_VALUE value;
48 char * string;
49 int integer;
50 struct list_id listing;
51 struct expr * expression;
52 struct datatype* type;
55 %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
56 %token tENABLE tDISABLE tBREAK tWATCH tDELETE tSET tMODE tPRINT tEXAM tABORT tVM86
57 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
58 %token tPROCESS tTHREAD tMODREF tEOL
59 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
60 %token tSTEPI tNEXTI tFINISH tSHOW tDIR tWHATIS
61 %token <string> tPATH
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
69 /* %left ',' */
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 */ /* ... ? ... : ... */
74 %left OP_LOR
75 %left OP_LAND
76 %left '|'
77 %left '^'
78 %left '&'
79 %left OP_EQ OP_NE
80 %left '<' '>' OP_LE OP_GE
81 %left OP_SHL OP_SHR
82 %left '+' '-'
83 %left '*' '/' '%'
84 %left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */
85 %left '.' '[' OP_DRF
86 %nonassoc ':'
88 %type <expression> expr lval lvalue
89 %type <type> type_cast type_expr
90 %type <value> expr_addr lval_addr
91 %type <integer> expr_value
92 %type <string> pathname identifier
94 %type <listing> list_arg
98 input: line
99 | input line
101 line: command
102 | tEOL
103 | error tEOL { yyerrok; }
105 command:
106 tQUIT tEOL { return EXIT_QUIT; }
107 | tHELP tEOL { DEBUG_Help(); }
108 | tHELP tINFO tEOL { DEBUG_HelpInfo(); }
109 | tCONT tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
110 DEBUG_CurrThread->dbg_exec_mode = EXEC_CONT; return EXIT_CONT; }
111 | tPASS tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
112 DEBUG_CurrThread->dbg_exec_mode = EXEC_PASS; return EXIT_CONT; }
113 | tCONT tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2;
114 DEBUG_CurrThread->dbg_exec_mode = EXEC_CONT; return EXIT_CONT; }
115 | tSTEP tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
116 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_INSTR; return EXIT_CONT; }
117 | tNEXT tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
118 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_OVER; return EXIT_CONT; }
119 | tSTEP tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2;
120 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_INSTR; return EXIT_CONT; }
121 | tNEXT tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2;
122 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEP_OVER; return EXIT_CONT; }
123 | tSTEPI tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
124 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_INSTR; return EXIT_CONT; }
125 | tNEXTI tEOL { DEBUG_CurrThread->dbg_exec_count = 1;
126 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_OVER; return EXIT_CONT; }
127 | tSTEPI tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2;
128 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_INSTR; return EXIT_CONT; }
129 | tNEXTI tNUM tEOL { DEBUG_CurrThread->dbg_exec_count = $2;
130 DEBUG_CurrThread->dbg_exec_mode = EXEC_STEPI_OVER; return EXIT_CONT; }
131 | tABORT tEOL { kill(getpid(), SIGABRT); }
132 | tMODE tNUM tEOL { mode_command($2); }
133 | tMODE tVM86 tEOL { DEBUG_CurrThread->dbg_mode = MODE_VM86; }
134 | tENABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, TRUE ); }
135 | tDISABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, FALSE ); }
136 | tDELETE tBREAK tNUM tEOL { DEBUG_DelBreakpoint( $3 ); }
137 | tBACKTRACE tEOL { DEBUG_BackTrace(DEBUG_CurrTid, TRUE); }
138 | tBACKTRACE tNUM tEOL { DEBUG_BackTrace($2, TRUE); }
139 | tUP tEOL { DEBUG_SetFrame( curr_frame + 1 ); }
140 | tUP tNUM tEOL { DEBUG_SetFrame( curr_frame + $2 ); }
141 | tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); }
142 | tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); }
143 | tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); }
144 | tFINISH tEOL { DEBUG_CurrThread->dbg_exec_count = 0;
145 DEBUG_CurrThread->dbg_exec_mode = EXEC_FINISH; return EXIT_CONT; }
146 | tSHOW tDIR tEOL { DEBUG_ShowDir(); }
147 | tDIR pathname tEOL { DEBUG_AddPath( $2 ); }
148 | tDIR tEOL { DEBUG_NukePath(); }
149 | tDISPLAY tEOL { DEBUG_InfoDisplay(); }
150 | tDISPLAY expr tEOL { DEBUG_AddDisplay($2, 1, 0); }
151 | tDISPLAY tFORMAT expr tEOL{ DEBUG_AddDisplay($3, $2 >> 8, $2 & 0xff); }
152 | tDELETE tDISPLAY tNUM tEOL{ DEBUG_DelDisplay( $3 ); }
153 | tDELETE tDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
154 | tUNDISPLAY tNUM tEOL { DEBUG_DelDisplay( $2 ); }
155 | tUNDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
156 | tCOND tNUM tEOL { DEBUG_AddBPCondition($2, NULL); }
157 | tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); }
158 | tSYMBOLFILE pathname tEOL { DEBUG_ReadSymbolTable($2); }
159 | tWHATIS expr_addr tEOL { DEBUG_PrintType(&$2); DEBUG_FreeExprMem(); }
160 | tATTACH tNUM tEOL { if (DEBUG_Attach($2, FALSE)) return EXIT_CONT; }
161 | tDETACH tEOL { return EXIT_DETACH; }
162 | list_command
163 | disassemble_command
164 | set_command
165 | x_command
166 | print_command
167 | break_command
168 | watch_command
169 | info_command
170 | walk_command
171 | run_command
172 | noprocess_state
174 set_command:
175 tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory( &$2, $4 );
176 DEBUG_FreeExprMem(); }
178 pathname:
179 tIDENTIFIER { $$ = $1; }
180 | tPATH { $$ = $1; }
182 disassemble_command:
183 tDISASSEMBLE tEOL { DEBUG_Disassemble( NULL, NULL, 10 ); }
184 | tDISASSEMBLE expr_addr tEOL { DEBUG_Disassemble( & $2, NULL, 10 ); }
185 | tDISASSEMBLE expr_addr ',' expr_addr tEOL { DEBUG_Disassemble( & $2, & $4, 0 ); }
187 list_command:
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 ); }
194 list_arg:
195 tNUM { $$.sourcefile = NULL; $$.line = $1; }
196 | pathname ':' tNUM { $$.sourcefile = $1; $$.line = $3; }
197 | tIDENTIFIER { DEBUG_GetFuncInfo( & $$, NULL, $1); }
198 | pathname ':' tIDENTIFIER { DEBUG_GetFuncInfo( & $$, $1, $3); }
199 | '*' expr_addr { DEBUG_FindNearestSymbol( & $2.addr, FALSE, NULL, 0, & $$ );
200 DEBUG_FreeExprMem(); }
202 x_command:
203 tEXAM expr_addr tEOL { DEBUG_ExamineMemory( &$2, 1, 'x'); DEBUG_FreeExprMem(); }
204 | tEXAM tFORMAT expr_addr tEOL { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff );
205 DEBUG_FreeExprMem(); }
207 print_command:
208 tPRINT expr_addr tEOL { DEBUG_Print( &$2, 1, 0, 0 ); DEBUG_FreeExprMem(); }
209 | tPRINT tFORMAT expr_addr tEOL { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff, 0 );
210 DEBUG_FreeExprMem(); }
212 break_command:
213 tBREAK '*' expr_addr tEOL{ DEBUG_AddBreakpoint( &$3, NULL ); DEBUG_FreeExprMem(); }
214 | tBREAK identifier tEOL { DEBUG_AddBreakpointFromId($2, -1); }
215 | tBREAK identifier ':' tNUM tEOL { DEBUG_AddBreakpointFromId($2, $4); }
216 | tBREAK tNUM tEOL { DEBUG_AddBreakpointFromLineno($2); }
217 | tBREAK tEOL { DEBUG_AddBreakpointFromLineno(-1); }
219 watch_command:
220 tWATCH '*' expr_addr tEOL { DEBUG_AddWatchpoint( &$3, 1 ); DEBUG_FreeExprMem(); }
221 | tWATCH identifier tEOL { DEBUG_AddWatchpointFromId($2); }
223 info_command:
224 tINFO tBREAK tEOL { DEBUG_InfoBreakpoints(); }
225 | tINFO tCLASS tSTRING tEOL { DEBUG_InfoClass( $3 ); }
226 | tINFO tSHARE tEOL { DEBUG_InfoShare(); }
227 | tINFO tMODULE expr_value tEOL { DEBUG_DumpModule( $3 ); DEBUG_FreeExprMem(); }
228 | tINFO tQUEUE expr_value tEOL { DEBUG_DumpQueue( $3 ); DEBUG_FreeExprMem(); }
229 | tINFO tREGS tEOL { DEBUG_InfoRegisters(); }
230 | tINFO tSEGMENTS expr_value tEOL { DEBUG_InfoSegments( $3, 1 ); DEBUG_FreeExprMem(); }
231 | tINFO tSEGMENTS tEOL { DEBUG_InfoSegments( 0, -1 ); }
232 | tINFO tSTACK tEOL { DEBUG_InfoStack(); }
233 | tINFO tMAPS tEOL { DEBUG_InfoVirtual(); }
234 | tINFO tWND expr_value tEOL{ DEBUG_InfoWindow( (HWND)$3 ); DEBUG_FreeExprMem(); }
235 | tINFO tLOCAL tEOL { DEBUG_InfoLocals(); }
236 | tINFO tDISPLAY tEOL { DEBUG_InfoDisplay(); }
238 walk_command:
239 tWALK tCLASS tEOL { DEBUG_WalkClasses(); }
240 | tWALK tMODULE tEOL { DEBUG_WalkModules(); }
241 | tWALK tQUEUE tEOL { DEBUG_WalkQueues(); }
242 | tWALK tWND tEOL { DEBUG_WalkWindows( 0, 0 ); }
243 | tWALK tWND tNUM tEOL { DEBUG_WalkWindows( (HWND)$3, 0 ); }
244 | tWALK tPROCESS tEOL { DEBUG_WalkProcess(); }
245 | tWALK tTHREAD tEOL { DEBUG_WalkThreads(); }
246 | tWALK tMODREF expr_value tEOL { DEBUG_WalkModref( $3 ); DEBUG_FreeExprMem(); }
248 run_command:
249 tRUN tEOL { DEBUG_Run(NULL); }
250 | tRUN tSTRING tEOL { DEBUG_Run($2); }
252 noprocess_state:
253 tNOPROCESS tEOL {} /* <CR> shall not barf anything */
254 | tNOPROCESS tSTRING tEOL { DEBUG_Printf(DBG_CHN_MESG, "No process loaded, cannot execute '%s'\n", $2); }
256 type_cast:
257 '(' type_expr ')' { $$ = $2; }
259 type_expr:
260 type_expr '*' { $$ = DEBUG_FindOrMakePointerType($1); }
261 | tINT { $$ = DEBUG_GetBasicType(DT_BASIC_INT); }
262 | tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_CHAR); }
263 | tLONG tINT { $$ = DEBUG_GetBasicType(DT_BASIC_LONGINT); }
264 | tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_UINT); }
265 | tLONG tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_ULONGINT); }
266 | tLONG tLONG tINT { $$ = DEBUG_GetBasicType(DT_BASIC_LONGLONGINT); }
267 | tLONG tLONG tUNSIGNED tINT{ $$ = DEBUG_GetBasicType(DT_BASIC_ULONGLONGINT); }
268 | tSHORT tINT { $$ = DEBUG_GetBasicType(DT_BASIC_SHORTINT); }
269 | tSHORT tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_USHORTINT); }
270 | tSIGNED tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_SCHAR); }
271 | tUNSIGNED tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_UCHAR); }
272 | tFLOAT { $$ = DEBUG_GetBasicType(DT_BASIC_FLOAT); }
273 | tDOUBLE { $$ = DEBUG_GetBasicType(DT_BASIC_DOUBLE); }
274 | tLONG tDOUBLE { $$ = DEBUG_GetBasicType(DT_BASIC_LONGDOUBLE); }
275 | tSTRUCT tIDENTIFIER { $$ = DEBUG_TypeCast(DT_STRUCT, $2); }
276 | tUNION tIDENTIFIER { $$ = DEBUG_TypeCast(DT_STRUCT, $2); }
277 | tENUM tIDENTIFIER { $$ = DEBUG_TypeCast(DT_ENUM, $2); }
279 expr_addr:
280 expr { $$ = DEBUG_EvalExpr($1); }
282 expr_value:
283 expr { DBG_VALUE value = DEBUG_EvalExpr($1);
284 /* expr_value is typed as an integer */
285 $$ = DEBUG_ReadMemory(&value); }
288 * The expr rule builds an expression tree. When we are done, we call
289 * EvalExpr to evaluate the value of the expression. The advantage of
290 * the two-step approach is that it is possible to save expressions for
291 * use in 'display' commands, and in conditional watchpoints.
293 expr:
294 tNUM { $$ = DEBUG_ConstExpr($1); }
295 | tSTRING { $$ = DEBUG_StringExpr($1); }
296 | tINTVAR { $$ = DEBUG_IntVarExpr($1); }
297 | tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
298 | expr OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
299 | expr '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
300 | tIDENTIFIER '(' ')' { $$ = DEBUG_CallExpr($1, 0); }
301 | tIDENTIFIER '(' expr ')' { $$ = DEBUG_CallExpr($1, 1, $3); }
302 | tIDENTIFIER '(' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 2, $3, $5); }
303 | tIDENTIFIER '(' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7); }
304 | tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 4, $3, $5, $7, $9); }
305 | tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 5, $3, $5, $7, $9, $11); }
306 | expr '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
307 | expr ':' expr { $$ = DEBUG_BinopExpr(EXP_OP_SEG, $1, $3); }
308 | expr OP_LOR expr { $$ = DEBUG_BinopExpr(EXP_OP_LOR, $1, $3); }
309 | expr OP_LAND expr { $$ = DEBUG_BinopExpr(EXP_OP_LAND, $1, $3); }
310 | expr '|' expr { $$ = DEBUG_BinopExpr(EXP_OP_OR, $1, $3); }
311 | expr '&' expr { $$ = DEBUG_BinopExpr(EXP_OP_AND, $1, $3); }
312 | expr '^' expr { $$ = DEBUG_BinopExpr(EXP_OP_XOR, $1, $3); }
313 | expr OP_EQ expr { $$ = DEBUG_BinopExpr(EXP_OP_EQ, $1, $3); }
314 | expr '>' expr { $$ = DEBUG_BinopExpr(EXP_OP_GT, $1, $3); }
315 | expr '<' expr { $$ = DEBUG_BinopExpr(EXP_OP_LT, $1, $3); }
316 | expr OP_GE expr { $$ = DEBUG_BinopExpr(EXP_OP_GE, $1, $3); }
317 | expr OP_LE expr { $$ = DEBUG_BinopExpr(EXP_OP_LE, $1, $3); }
318 | expr OP_NE expr { $$ = DEBUG_BinopExpr(EXP_OP_NE, $1, $3); }
319 | expr OP_SHL expr { $$ = DEBUG_BinopExpr(EXP_OP_SHL, $1, $3); }
320 | expr OP_SHR expr { $$ = DEBUG_BinopExpr(EXP_OP_SHR, $1, $3); }
321 | expr '+' expr { $$ = DEBUG_BinopExpr(EXP_OP_ADD, $1, $3); }
322 | expr '-' expr { $$ = DEBUG_BinopExpr(EXP_OP_SUB, $1, $3); }
323 | expr '*' expr { $$ = DEBUG_BinopExpr(EXP_OP_MUL, $1, $3); }
324 | expr '/' expr { $$ = DEBUG_BinopExpr(EXP_OP_DIV, $1, $3); }
325 | expr '%' expr { $$ = DEBUG_BinopExpr(EXP_OP_REM, $1, $3); }
326 | '-' expr %prec OP_SIGN { $$ = DEBUG_UnopExpr(EXP_OP_NEG, $2); }
327 | '+' expr %prec OP_SIGN { $$ = $2; }
328 | '!' expr { $$ = DEBUG_UnopExpr(EXP_OP_NOT, $2); }
329 | '~' expr { $$ = DEBUG_UnopExpr(EXP_OP_LNOT, $2); }
330 | '(' expr ')' { $$ = $2; }
331 | '*' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_DEREF, $2); }
332 | '&' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_ADDR, $2); }
333 | type_cast expr %prec OP_DEREF { $$ = DEBUG_TypeCastExpr($1, $2); }
336 * The lvalue rule builds an expression tree. This is a limited form
337 * of expression that is suitable to be used as an lvalue.
339 lval_addr:
340 lval { $$ = DEBUG_EvalExpr($1); }
342 lval:
343 lvalue { $$ = $1; }
344 | '*' expr { $$ = DEBUG_UnopExpr(EXP_OP_FORCE_DEREF, $2); }
346 lvalue:
347 tNUM { $$ = DEBUG_ConstExpr($1); }
348 | tINTVAR { $$ = DEBUG_IntVarExpr($1); }
349 | tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
350 | lvalue OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
351 | lvalue '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
352 | lvalue '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
354 identifier:
355 tIDENTIFIER { $$ = $1; }
356 | identifier '.' tIDENTIFIER { char* ptr = DBG_alloc(strlen($1) + 1 + strlen($3)+ 1);
357 sprintf(ptr, "%s.%s", $1, $3); $$ = DEBUG_MakeSymbol(ptr);
358 DBG_free(ptr); }
359 | identifier ':' ':' tIDENTIFIER { char* ptr = DBG_alloc(strlen($1) + 2 + strlen($4) + 1);
360 sprintf(ptr, "%s::%s", $1, $4); $$ = DEBUG_MakeSymbol(ptr);
361 DBG_free(ptr); }
365 static void mode_command(int newmode)
367 switch(newmode)
369 case 16: DEBUG_CurrThread->dbg_mode = MODE_16; break;
370 case 32: DEBUG_CurrThread->dbg_mode = MODE_32; break;
371 default: DEBUG_Printf(DBG_CHN_MESG,"Invalid mode (use 16, 32 or vm86)\n");
375 void DEBUG_Exit(DWORD ec)
377 ExitProcess(ec);
380 static WINE_EXCEPTION_FILTER(wine_dbg_cmd)
382 DEBUG_Printf(DBG_CHN_MESG, "\nwine_dbg_cmd: ");
383 switch (GetExceptionCode()) {
384 case DEBUG_STATUS_INTERNAL_ERROR:
385 DEBUG_Printf(DBG_CHN_MESG, "WineDbg internal error\n");
386 break;
387 case DEBUG_STATUS_NO_SYMBOL:
388 DEBUG_Printf(DBG_CHN_MESG, "Undefined symbol\n");
389 break;
390 case DEBUG_STATUS_DIV_BY_ZERO:
391 DEBUG_Printf(DBG_CHN_MESG, "Division by zero\n");
392 break;
393 case DEBUG_STATUS_BAD_TYPE:
394 DEBUG_Printf(DBG_CHN_MESG, "No type or type mismatch\n");
395 break;
396 case DEBUG_STATUS_NO_FIELD:
397 DEBUG_Printf(DBG_CHN_MESG, "No such field in structure or union\n");
398 break;
399 default:
400 DEBUG_Printf(DBG_CHN_MESG, "Exception %lx\n", GetExceptionCode());
401 break;
404 return EXCEPTION_EXECUTE_HANDLER;
407 /***********************************************************************
408 * DEBUG_Parser
410 * Debugger editline parser
412 enum exit_mode DEBUG_Parser(void)
414 BOOL ret_ok;
415 enum exit_mode ret = EXIT_CONT;
416 #ifdef YYDEBUG
417 yydebug = 0;
418 #endif
419 yyin = stdin;
421 ret_ok = FALSE;
422 do {
423 __TRY {
424 ret_ok = TRUE;
425 if ((ret = yyparse())) {
426 DEBUG_FlushSymbols();
428 } __EXCEPT(wine_dbg_cmd) {
429 ret_ok = FALSE;
431 __ENDTRY;
433 } while (!ret_ok);
434 return ret;
437 int yyerror(char* s)
439 DEBUG_Printf(DBG_CHN_MESG, "%s\n", s);
440 return 0;