Release 970202
[wine/multimedia.git] / debugger / dbg.y
blobb87291aa21fdfcd559c8b3a6f50c62841fc6a8fc
1 %{
2 /*
3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
7 */
9 #include <stdio.h>
10 #include <signal.h>
11 #include <unistd.h>
12 #include "class.h"
13 #include "module.h"
14 #include "options.h"
15 #include "queue.h"
16 #include "win.h"
17 #include "winnt.h"
18 #include "debugger.h"
20 #include "expr.h"
22 extern FILE * yyin;
23 unsigned int dbg_mode = 0;
24 int curr_frame = 0;
26 static enum exec_mode dbg_exec_mode = EXEC_CONT;
27 static int dbg_exec_count = 0;
29 void issue_prompt(void);
30 void mode_command(int);
31 void flush_symbols(void);
32 int yylex(void);
33 int yyerror(char *);
37 %union
39 DBG_ADDR address;
40 enum debug_regs reg;
41 char * string;
42 int integer;
43 struct list_id listing;
44 struct expr * expression;
45 struct datatype * type;
48 %token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
49 %token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT
50 %token tCLASS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
51 %token tEOL tSTRING
52 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY
53 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
54 %token <string> tPATH
55 %token <string> tIDENTIFIER tSTRING
56 %token <integer> tNUM tFORMAT
57 %token <reg> tREG
59 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
60 %token tSTRUCT tUNION tENUM
62 /* %left ',' */
63 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
64 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
65 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
66 /* %left OP_COND */ /* ... ? ... : ... */
67 %left OP_LOR
68 %left OP_LAND
69 %left '|'
70 %left '^'
71 %left '&'
72 %left OP_EQ OP_NE
73 %left '<' '>' OP_LE OP_GE
74 %left OP_SHL OP_SHR
75 %left '+' '-'
76 %left '*' '/' '%'
77 %left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */
78 %left '.' '[' OP_DRF
79 %nonassoc ':'
81 %type <expression> expr lval lvalue
82 %type <type> type_cast type_expr
83 %type <address> expr_addr lval_addr
84 %type <integer> expr_value
85 %type <string> pathname
87 %type <listing> list_arg
91 input: line { issue_prompt(); }
92 | input line { issue_prompt(); }
94 line: command
95 | tEOL
96 | error tEOL { yyerrok; }
98 command:
99 tQUIT tEOL { exit(0); }
100 | tHELP tEOL { DEBUG_Help(); }
101 | tHELP tINFO tEOL { DEBUG_HelpInfo(); }
102 | tCONT tEOL { dbg_exec_count = 1;
103 dbg_exec_mode = EXEC_CONT; return 0; }
104 | tCONT tNUM tEOL { dbg_exec_count = $2;
105 dbg_exec_mode = EXEC_CONT; return 0; }
106 | tSTEP tEOL { dbg_exec_count = 1;
107 dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
108 | tNEXT tEOL { dbg_exec_count = 1;
109 dbg_exec_mode = EXEC_STEP_OVER; return 0; }
110 | tSTEP tNUM tEOL { dbg_exec_count = $2;
111 dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
112 | tNEXT tNUM tEOL { dbg_exec_count = $2;
113 dbg_exec_mode = EXEC_STEP_OVER; return 0; }
114 | tSTEPI tEOL { dbg_exec_count = 1;
115 dbg_exec_mode = EXEC_STEPI_INSTR; return 0; }
116 | tNEXTI tEOL { dbg_exec_count = 1;
117 dbg_exec_mode = EXEC_STEPI_OVER; return 0; }
118 | tSTEPI tNUM tEOL { dbg_exec_count = $2;
119 dbg_exec_mode = EXEC_STEPI_INSTR; return 0; }
120 | tNEXTI tNUM tEOL { dbg_exec_count = $2;
121 dbg_exec_mode = EXEC_STEPI_OVER; return 0; }
122 | tABORT tEOL { kill(getpid(), SIGABRT); }
123 | tMODE tNUM tEOL { mode_command($2); }
124 | tENABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, TRUE ); }
125 | tDISABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, FALSE ); }
126 | tDELETE tBREAK tNUM tEOL { DEBUG_DelBreakpoint( $3 ); }
127 | tBACKTRACE tEOL { DEBUG_BackTrace(); }
128 | tUP tEOL { DEBUG_SetFrame( curr_frame + 1 ); }
129 | tUP tNUM tEOL { DEBUG_SetFrame( curr_frame + $2 ); }
130 | tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); }
131 | tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); }
132 | tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); }
133 | tFINISH tEOL { dbg_exec_count = 0;
134 dbg_exec_mode = EXEC_FINISH; return 0; }
135 | tSHOW tDIR tEOL { DEBUG_ShowDir(); }
136 | tDIR pathname tEOL { DEBUG_AddPath( $2 ); }
137 | tDIR tEOL { DEBUG_NukePath(); }
138 | tDISPLAY tEOL { DEBUG_InfoDisplay(); }
139 | tDISPLAY expr tEOL { DEBUG_AddDisplay($2, 1, 0); }
140 | tDISPLAY tFORMAT expr tEOL { DEBUG_AddDisplay($3, $2 >> 8, $2 & 0xff); }
141 | tDELETE tDISPLAY tNUM tEOL { DEBUG_DelDisplay( $3 ); }
142 | tDELETE tDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
143 | tUNDISPLAY tNUM tEOL { DEBUG_DelDisplay( $2 ); }
144 | tUNDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
145 | tCOND tNUM tEOL { DEBUG_AddBPCondition($2, NULL); }
146 | tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); }
147 | list_command
148 | set_command
149 | x_command
150 | print_command
151 | break_command
152 | info_command
153 | walk_command
155 set_command:
156 tSET tREG '=' expr_value tEOL { DEBUG_SetRegister( $2, $4 );
157 DEBUG_FreeExprMem(); }
158 | tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory( &$2, $4 );
159 DEBUG_FreeExprMem(); }
161 pathname:
162 tIDENTIFIER { $$ = $1; }
163 | tPATH { $$ = $1; }
165 list_command:
166 tLIST tEOL { DEBUG_List( NULL, NULL, 10 ); }
167 | tLIST '-' tEOL { DEBUG_List( NULL, NULL, -10 ); }
168 | tLIST list_arg tEOL { DEBUG_List( & $2, NULL, 10 ); }
169 | tLIST ',' list_arg tEOL { DEBUG_List( NULL, & $3, -10 ); }
170 | tLIST list_arg ',' list_arg tEOL { DEBUG_List( & $2, & $4, 0 ); }
172 list_arg:
173 tNUM { $$.sourcefile = NULL; $$.line = $1; }
174 | pathname ':' tNUM { $$.sourcefile = $1; $$.line = $3; }
175 | tIDENTIFIER { DEBUG_GetFuncInfo( & $$, NULL, $1); }
176 | pathname ':' tIDENTIFIER { DEBUG_GetFuncInfo( & $$, $1, $3); }
177 | '*' expr_addr { DEBUG_FindNearestSymbol( & $2, FALSE, NULL,
178 0, & $$ );
179 DEBUG_FreeExprMem(); }
181 x_command:
182 tEXAM expr_addr tEOL { DEBUG_ExamineMemory( &$2, 1, 'x');
183 DEBUG_FreeExprMem(); }
184 | tEXAM tFORMAT expr_addr tEOL { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff );
185 DEBUG_FreeExprMem(); }
187 print_command:
188 tPRINT expr_addr tEOL { DEBUG_Print( &$2, 1, 0, 0 );
189 DEBUG_FreeExprMem(); }
190 | tPRINT tFORMAT expr_addr tEOL { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff, 0 );
191 DEBUG_FreeExprMem(); }
193 break_command:
194 tBREAK '*' expr_addr tEOL { DEBUG_AddBreakpoint( &$3 );
195 DEBUG_FreeExprMem(); }
196 | tBREAK tIDENTIFIER tEOL { DBG_ADDR addr;
197 if( DEBUG_GetSymbolValue($2, -1, &addr, TRUE) )
199 DEBUG_AddBreakpoint( &addr );
201 else
203 fprintf(stderr,"Unable to add breakpoint\n");
206 | tBREAK tIDENTIFIER ':' tNUM tEOL { DBG_ADDR addr;
207 if( DEBUG_GetSymbolValue($2, $4, &addr, TRUE) )
209 DEBUG_AddBreakpoint( &addr );
211 else
213 fprintf(stderr,"Unable to add breakpoint\n");
216 | tBREAK tNUM tEOL { struct name_hash *nh;
217 DBG_ADDR addr = { NULL,
218 CS_reg(&DEBUG_context),
219 EIP_reg(&DEBUG_context) };
221 DBG_FIX_ADDR_SEG( &addr, CS_reg(&DEBUG_context) );
222 DEBUG_FindNearestSymbol(&addr, TRUE,
223 &nh, 0, NULL);
224 if( nh != NULL )
226 DEBUG_GetLineNumberAddr(nh,
227 $2, &addr, TRUE);
228 DEBUG_AddBreakpoint( &addr );
230 else
232 fprintf(stderr,"Unable to add breakpoint\n");
236 | tBREAK tEOL { DBG_ADDR addr = { NULL,
237 CS_reg(&DEBUG_context),
238 EIP_reg(&DEBUG_context) };
239 DEBUG_AddBreakpoint( &addr );
242 info_command:
243 tINFO tBREAK tEOL { DEBUG_InfoBreakpoints(); }
244 | tINFO tCLASS expr_value tEOL { CLASS_DumpClass( (CLASS *)$3 );
245 DEBUG_FreeExprMem(); }
246 | tINFO tSHARE tEOL { DEBUG_InfoShare(); }
247 | tINFO tMODULE expr_value tEOL { MODULE_DumpModule( $3 );
248 DEBUG_FreeExprMem(); }
249 | tINFO tQUEUE expr_value tEOL { QUEUE_DumpQueue( $3 );
250 DEBUG_FreeExprMem(); }
251 | tINFO tREGS tEOL { DEBUG_InfoRegisters(); }
252 | tINFO tSEGMENTS expr_value tEOL { LDT_Print( SELECTOR_TO_ENTRY($3), 1 );
253 DEBUG_FreeExprMem(); }
254 | tINFO tSEGMENTS tEOL { LDT_Print( 0, -1 ); }
255 | tINFO tSTACK tEOL { DEBUG_InfoStack(); }
256 | tINFO tWND expr_value tEOL { WIN_DumpWindow( $3 );
257 DEBUG_FreeExprMem(); }
258 | tINFO tLOCAL tEOL { DEBUG_InfoLocals(); }
259 | tINFO tDISPLAY tEOL { DEBUG_InfoDisplay(); }
261 walk_command:
262 tWALK tCLASS tEOL { CLASS_WalkClasses(); }
263 | tWALK tMODULE tEOL { MODULE_WalkModules(); }
264 | tWALK tQUEUE tEOL { QUEUE_WalkQueues(); }
265 | tWALK tWND tEOL { WIN_WalkWindows( 0, 0 ); }
266 | tWALK tWND tNUM tEOL { WIN_WalkWindows( $3, 0 ); }
269 type_cast:
270 '(' type_expr ')' { $$ = $2; }
272 type_expr:
273 type_expr '*' { $$ = DEBUG_FindOrMakePointerType($1); }
274 | tINT { $$ = DEBUG_TypeCast(BASIC, "int"); }
275 | tCHAR { $$ = DEBUG_TypeCast(BASIC, "char"); }
276 | tLONG tINT { $$ = DEBUG_TypeCast(BASIC, "long int"); }
277 | tUNSIGNED tINT { $$ = DEBUG_TypeCast(BASIC, "unsigned int"); }
278 | tLONG tUNSIGNED tINT { $$ = DEBUG_TypeCast(BASIC, "long unsigned int"); }
279 | tLONG tLONG tINT { $$ = DEBUG_TypeCast(BASIC, "long long int"); }
280 | tLONG tLONG tUNSIGNED tINT { $$ = DEBUG_TypeCast(BASIC, "long long unsigned int"); }
281 | tSHORT tINT { $$ = DEBUG_TypeCast(BASIC, "short int"); }
282 | tSHORT tUNSIGNED tINT { $$ = DEBUG_TypeCast(BASIC, "short unsigned int"); }
283 | tSIGNED tCHAR { $$ = DEBUG_TypeCast(BASIC, "signed char"); }
284 | tUNSIGNED tCHAR { $$ = DEBUG_TypeCast(BASIC, "unsigned char"); }
285 | tFLOAT { $$ = DEBUG_TypeCast(BASIC, "float"); }
286 | tDOUBLE { $$ = DEBUG_TypeCast(BASIC, "double"); }
287 | tLONG tDOUBLE { $$ = DEBUG_TypeCast(BASIC, "long double"); }
288 | tSTRUCT tIDENTIFIER { $$ = DEBUG_TypeCast(STRUCT, $2); }
289 | tUNION tIDENTIFIER { $$ = DEBUG_TypeCast(STRUCT, $2); }
290 | tENUM tIDENTIFIER { $$ = DEBUG_TypeCast(ENUM, $2); }
292 expr_addr:
293 expr { $$ = DEBUG_EvalExpr($1); }
295 expr_value:
296 expr { DBG_ADDR addr = DEBUG_EvalExpr($1);
297 $$ = *(unsigned int *) addr.off; }
299 * The expr rule builds an expression tree. When we are done, we call
300 * EvalExpr to evaluate the value of the expression. The advantage of
301 * the two-step approach is that it is possible to save expressions for
302 * use in 'display' commands, and in conditional watchpoints.
304 expr:
305 tNUM { $$ = DEBUG_ConstExpr($1); }
306 | tSTRING { $$ = DEBUG_StringExpr($1); }
307 | tREG { $$ = DEBUG_RegisterExpr($1); }
308 | tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
309 | expr OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
310 | expr '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
311 | tIDENTIFIER '(' ')' { $$ = DEBUG_CallExpr($1, 0); }
312 | tIDENTIFIER '(' expr ')' { $$ = DEBUG_CallExpr($1, 1, $3); }
313 | tIDENTIFIER '(' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 2, $3,
314 $5); }
315 | tIDENTIFIER '(' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7); }
316 | tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7, $9); }
317 | tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7, $9, $11); }
318 | expr '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
319 | expr ':' expr { $$ = DEBUG_BinopExpr(EXP_OP_SEG, $1, $3); }
320 | expr OP_LOR expr { $$ = DEBUG_BinopExpr(EXP_OP_LOR, $1, $3); }
321 | expr OP_LAND expr { $$ = DEBUG_BinopExpr(EXP_OP_LAND, $1, $3); }
322 | expr '|' expr { $$ = DEBUG_BinopExpr(EXP_OP_OR, $1, $3); }
323 | expr '&' expr { $$ = DEBUG_BinopExpr(EXP_OP_AND, $1, $3); }
324 | expr '^' expr { $$ = DEBUG_BinopExpr(EXP_OP_XOR, $1, $3); }
325 | expr OP_EQ expr { $$ = DEBUG_BinopExpr(EXP_OP_EQ, $1, $3); }
326 | expr '>' expr { $$ = DEBUG_BinopExpr(EXP_OP_GT, $1, $3); }
327 | expr '<' expr { $$ = DEBUG_BinopExpr(EXP_OP_LT, $1, $3); }
328 | expr OP_GE expr { $$ = DEBUG_BinopExpr(EXP_OP_GE, $1, $3); }
329 | expr OP_LE expr { $$ = DEBUG_BinopExpr(EXP_OP_LE, $1, $3); }
330 | expr OP_NE expr { $$ = DEBUG_BinopExpr(EXP_OP_NE, $1, $3); }
331 | expr OP_SHL expr { $$ = DEBUG_BinopExpr(EXP_OP_SHL, $1, $3); }
332 | expr OP_SHR expr { $$ = DEBUG_BinopExpr(EXP_OP_SHR, $1, $3); }
333 | expr '+' expr { $$ = DEBUG_BinopExpr(EXP_OP_ADD, $1, $3); }
334 | expr '-' expr { $$ = DEBUG_BinopExpr(EXP_OP_SUB, $1, $3); }
335 | expr '*' expr { $$ = DEBUG_BinopExpr(EXP_OP_MUL, $1, $3); }
336 | expr '/' expr { $$ = DEBUG_BinopExpr(EXP_OP_DIV, $1, $3); }
337 | expr '%' expr { $$ = DEBUG_BinopExpr(EXP_OP_REM, $1, $3); }
338 | '-' expr %prec OP_SIGN { $$ = DEBUG_UnopExpr(EXP_OP_NEG, $2); }
339 | '+' expr %prec OP_SIGN { $$ = $2; }
340 | '!' expr { $$ = DEBUG_UnopExpr(EXP_OP_NOT, $2); }
341 | '~' expr { $$ = DEBUG_UnopExpr(EXP_OP_LNOT, $2); }
342 | '(' expr ')' { $$ = $2; }
343 | '*' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_DEREF, $2); }
344 | '&' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_ADDR, $2); }
345 | type_cast expr %prec OP_DEREF { $$ = DEBUG_TypeCastExpr($1, $2); }
348 * The lvalue rule builds an expression tree. This is a limited form
349 * of expression that is suitable to be used as an lvalue.
351 lval_addr:
352 lval { $$ = DEBUG_EvalExpr($1); }
354 lval:
355 lvalue { $$ = $1; }
356 | '*' expr { $$ = DEBUG_UnopExpr(EXP_OP_FORCE_DEREF, $2); }
358 lvalue:
359 tNUM { $$ = DEBUG_ConstExpr($1); }
360 | tREG { $$ = DEBUG_RegisterExpr($1); }
361 | tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
362 | lvalue OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
363 | lvalue '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
364 | lvalue '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
368 void
369 issue_prompt(){
370 #ifdef DONT_USE_READLINE
371 fprintf(stderr,"Wine-dbg>");
372 #endif
375 void mode_command(int newmode)
377 if ((newmode == 16) || (newmode == 32)) dbg_mode = newmode;
378 else fprintf(stderr,"Invalid mode (use 16 or 32)\n");
382 /***********************************************************************
383 * DEBUG_Main
385 * Debugger main loop.
387 static void DEBUG_Main( int signal )
389 static int loaded_symbols = 0;
390 static BOOL32 in_debugger = FALSE;
391 char SymbolTableFile[256];
392 int newmode;
393 BOOL32 ret_ok;
394 #ifdef YYDEBUG
395 yydebug = 0;
396 #endif
398 if (in_debugger)
400 fprintf( stderr, "Segmentation fault inside debugger, exiting.\n" );
401 exit(1);
403 in_debugger = TRUE;
404 yyin = stdin;
406 DEBUG_SetBreakpoints( FALSE );
408 if (!loaded_symbols)
410 loaded_symbols++;
413 * Initialize the type handling stuff.
415 DEBUG_InitTypes();
418 * In some cases we can read the stabs information directly
419 * from the executable. If this is the case, we don't need
420 * to bother with trying to read a symbol file, as the stabs
421 * also have line number and local variable information.
422 * As long as gcc is used for the compiler, stabs will
423 * be the default. On SVr4, DWARF could be used, but we
424 * don't grok that yet, and in this case we fall back to using
425 * the wine.sym file.
427 if( DEBUG_ReadExecutableDbgInfo() == FALSE )
429 PROFILE_GetWineIniString( "wine", "SymbolTableFile", "wine.sym",
430 SymbolTableFile, sizeof(SymbolTableFile));
431 DEBUG_ReadSymbolTable( SymbolTableFile );
435 * Read COFF, MSC, etc debug information that we noted when we
436 * started up the executable.
438 DEBUG_ProcessDeferredDebug();
440 DEBUG_LoadEntryPoints();
443 #if 0
444 fprintf(stderr, "Entering debugger PC=%x, mode=%d, count=%d\n",
445 EIP_reg(&DEBUG_context),
446 dbg_exec_mode, dbg_exec_count);
448 sleep(1);
449 #endif
451 if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( dbg_exec_mode,
452 &dbg_exec_count ))
454 DBG_ADDR addr;
456 addr.seg = CS_reg(&DEBUG_context);
457 addr.off = EIP_reg(&DEBUG_context);
458 addr.type = NULL;
459 DBG_FIX_ADDR_SEG( &addr, 0 );
461 /* Put the display in a correct state */
463 XUngrabPointer( display, CurrentTime );
464 XUngrabServer( display );
465 XFlush( display );
467 if (!addr.seg) newmode = 32;
468 else newmode = (GET_SEL_FLAGS(addr.seg) & LDT_FLAGS_32BIT) ? 32 : 16;
470 if (newmode != dbg_mode)
471 fprintf(stderr,"In %d bit mode.\n", dbg_mode = newmode);
473 DEBUG_DoDisplay();
475 if (signal != SIGTRAP) /* This is a real crash, dump some info */
477 DEBUG_InfoRegisters();
478 DEBUG_InfoStack();
479 if (dbg_mode == 16)
481 LDT_Print( SELECTOR_TO_ENTRY(DS_reg(&DEBUG_context)), 1 );
482 if (ES_reg(&DEBUG_context) != DS_reg(&DEBUG_context))
483 LDT_Print( SELECTOR_TO_ENTRY(ES_reg(&DEBUG_context)), 1 );
485 DEBUG_BackTrace();
487 else
490 * Do a quiet backtrace so that we have an idea of what the situation
491 * is WRT the source files.
493 DEBUG_SilentBackTrace();
496 if( signal != SIGTRAP )
498 /* Show where we crashed */
499 curr_frame = 0;
500 DEBUG_PrintAddress( &addr, dbg_mode, TRUE );
501 fprintf(stderr,": ");
502 if (DBG_CHECK_READ_PTR( &addr, 1 ))
504 DEBUG_Disasm( &addr, TRUE );
505 fprintf(stderr,"\n");
509 ret_ok = 0;
512 issue_prompt();
513 yyparse();
514 flush_symbols();
515 addr.seg = CS_reg(&DEBUG_context);
516 addr.off = EIP_reg(&DEBUG_context);
517 DBG_FIX_ADDR_SEG( &addr, 0 );
518 ret_ok = DEBUG_ValidateRegisters();
519 if (ret_ok) ret_ok = DBG_CHECK_READ_PTR( &addr, 1 );
520 } while (!ret_ok);
523 dbg_exec_mode = DEBUG_RestartExecution( dbg_exec_mode, dbg_exec_count );
525 * This will have gotten absorbed into the breakpoint info
526 * if it was used. Otherwise it would have been ignored.
527 * In any case, we don't mess with it any more.
529 if( dbg_exec_mode == EXEC_CONT )
531 dbg_exec_count = 0;
534 in_debugger = FALSE;
538 /***********************************************************************
539 * DebugBreak16 (KERNEL.203)
541 void DebugBreak16( CONTEXT *regs )
543 const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
544 fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" );
545 DEBUG_context = *regs;
546 DEBUG_Main( SIGTRAP );
550 void wine_debug( int signal, SIGCONTEXT *regs )
552 DEBUG_SetSigContext( regs );
553 #if 0
554 DWORD *stack = (DWORD *)ESP_reg(&DEBUG_context);
555 *(--stack) = 0;
556 *(--stack) = 0;
557 *(--stack) = EH_NONCONTINUABLE;
558 *(--stack) = EXCEPTION_ACCESS_VIOLATION;
559 *(--stack) = EIP_reg(&DEBUG_context);
560 ESP_reg(&DEBUG_context) = (DWORD)stack;
561 EIP_reg(&DEBUG_context) = GetProcAddress32( GetModuleHandle("KERNEL32"),
562 "RaiseException" );
563 #endif
564 DEBUG_Main( signal );
565 DEBUG_GetSigContext( regs );
568 int yyerror(char * s)
570 fprintf(stderr,"%s\n", s);
571 return 0;