3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
25 unsigned int dbg_mode
= 0;
28 static enum exec_mode dbg_exec_mode
= EXEC_CONT
;
29 static int dbg_exec_count
= 0;
31 void issue_prompt
(void);
32 void mode_command
(int);
33 void flush_symbols
(void);
37 extern
void VIRTUAL_Dump
(void); /* memory/virtual.c */
47 struct list_id listing
;
48 struct expr
* expression
;
49 struct datatype
* type
;
52 %token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
53 %token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT
54 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
56 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
57 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
59 %token
<string> tIDENTIFIER tSTRING
60 %token
<integer
> tNUM tFORMAT
63 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
64 %token tSTRUCT tUNION tENUM
67 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
68 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
69 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
70 /* %left OP_COND */ /* ... ? ... : ... */
77 %left
'<' '>' OP_LE OP_GE
81 %left OP_SIGN
'!' '~' OP_DEREF
/* OP_INC OP_DEC OP_ADDR */
85 %type
<expression
> expr lval lvalue
86 %type
<type
> type_cast type_expr
87 %type
<address
> expr_addr lval_addr
88 %type
<integer
> expr_value
89 %type
<string> pathname
91 %type
<listing
> list_arg
95 input: line
{ issue_prompt
(); }
96 | input line
{ issue_prompt
(); }
100 |
error tEOL
{ yyerrok; }
103 tQUIT tEOL
{ exit
(0); }
104 | tHELP tEOL
{ DEBUG_Help
(); }
105 | tHELP tINFO tEOL
{ DEBUG_HelpInfo
(); }
106 | tCONT tEOL
{ dbg_exec_count
= 1;
107 dbg_exec_mode
= EXEC_CONT
; return
0; }
108 | tCONT tNUM tEOL
{ dbg_exec_count
= $2;
109 dbg_exec_mode
= EXEC_CONT
; return
0; }
110 | tSTEP tEOL
{ dbg_exec_count
= 1;
111 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
112 | tNEXT tEOL
{ dbg_exec_count
= 1;
113 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
114 | tSTEP tNUM tEOL
{ dbg_exec_count
= $2;
115 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
116 | tNEXT tNUM tEOL
{ dbg_exec_count
= $2;
117 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
118 | tSTEPI tEOL
{ dbg_exec_count
= 1;
119 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
120 | tNEXTI tEOL
{ dbg_exec_count
= 1;
121 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
122 | tSTEPI tNUM tEOL
{ dbg_exec_count
= $2;
123 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
124 | tNEXTI tNUM tEOL
{ dbg_exec_count
= $2;
125 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
126 | tABORT tEOL
{ kill
(getpid
(), SIGABRT
); }
127 | tMODE tNUM tEOL
{ mode_command
($2); }
128 | tENABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, TRUE
); }
129 | tDISABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, FALSE
); }
130 | tDELETE tBREAK tNUM tEOL
{ DEBUG_DelBreakpoint
( $3 ); }
131 | tBACKTRACE tEOL
{ DEBUG_BackTrace
(); }
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 | tFINISH tEOL
{ dbg_exec_count
= 0;
138 dbg_exec_mode
= EXEC_FINISH
; return
0; }
139 | tSHOW tDIR tEOL
{ DEBUG_ShowDir
(); }
140 | tDIR pathname tEOL
{ DEBUG_AddPath
( $2 ); }
141 | tDIR tEOL
{ DEBUG_NukePath
(); }
142 | tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
143 | tDISPLAY expr tEOL
{ DEBUG_AddDisplay
($2, 1, 0); }
144 | tDISPLAY tFORMAT expr tEOL
{ DEBUG_AddDisplay
($3, $2 >> 8, $2 & 0xff); }
145 | tDELETE tDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $3 ); }
146 | tDELETE tDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
147 | tUNDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $2 ); }
148 | tUNDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
149 | tCOND tNUM tEOL
{ DEBUG_AddBPCondition
($2, NULL
); }
150 | tCOND tNUM expr tEOL
{ DEBUG_AddBPCondition
($2, $3); }
152 | disassemble_command
161 tSET tREG
'=' expr_value tEOL
{ DEBUG_SetRegister
( $2, $4 );
162 DEBUG_FreeExprMem
(); }
163 | tSET lval_addr
'=' expr_value tEOL
{ DEBUG_WriteMemory
( &$2, $4 );
164 DEBUG_FreeExprMem
(); }
167 tIDENTIFIER
{ $$
= $1; }
171 tDISASSEMBLE tEOL
{ DEBUG_Disassemble
( NULL
, NULL
, 10 ); }
172 | tDISASSEMBLE expr_addr tEOL
{ DEBUG_Disassemble
( & $2, NULL
, 10 ); }
173 | tDISASSEMBLE expr_addr
',' expr_addr tEOL
{ DEBUG_Disassemble
( & $2, & $4, 0 ); }
176 tLIST tEOL
{ DEBUG_List
( NULL
, NULL
, 10 ); }
177 | tLIST
'-' tEOL
{ DEBUG_List
( NULL
, NULL
, -10 ); }
178 | tLIST list_arg tEOL
{ DEBUG_List
( & $2, NULL
, 10 ); }
179 | tLIST
',' list_arg tEOL
{ DEBUG_List
( NULL
, & $3, -10 ); }
180 | tLIST list_arg
',' list_arg tEOL
{ DEBUG_List
( & $2, & $4, 0 ); }
183 tNUM
{ $$.sourcefile
= NULL
; $$.line
= $1; }
184 | pathname
':' tNUM
{ $$.sourcefile
= $1; $$.line
= $3; }
185 | tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, NULL
, $1); }
186 | pathname
':' tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, $1, $3); }
187 |
'*' expr_addr
{ DEBUG_FindNearestSymbol
( & $2, FALSE
, NULL
,
189 DEBUG_FreeExprMem
(); }
192 tEXAM expr_addr tEOL
{ DEBUG_ExamineMemory
( &$2, 1, 'x');
193 DEBUG_FreeExprMem
(); }
194 | tEXAM tFORMAT expr_addr tEOL
{ DEBUG_ExamineMemory
( &$3, $2>>8, $2&0xff );
195 DEBUG_FreeExprMem
(); }
198 tPRINT expr_addr tEOL
{ DEBUG_Print
( &$2, 1, 0, 0 );
199 DEBUG_FreeExprMem
(); }
200 | tPRINT tFORMAT expr_addr tEOL
{ DEBUG_Print
( &$3, $2 >> 8, $2 & 0xff, 0 );
201 DEBUG_FreeExprMem
(); }
204 tBREAK
'*' expr_addr tEOL
{ DEBUG_AddBreakpoint
( &$3 );
205 DEBUG_FreeExprMem
(); }
206 | tBREAK tIDENTIFIER tEOL
{ DBG_ADDR addr
;
207 if
( DEBUG_GetSymbolValue
($2, -1, &addr
, TRUE
) )
209 DEBUG_AddBreakpoint
( &addr
);
213 fprintf
(stderr
,"Unable to add breakpoint\n");
216 | tBREAK tIDENTIFIER
':' tNUM tEOL
{ DBG_ADDR addr
;
217 if
( DEBUG_GetSymbolValue
($2, $4, &addr
, TRUE
) )
219 DEBUG_AddBreakpoint
( &addr
);
223 fprintf
(stderr
,"Unable to add breakpoint\n");
226 | tBREAK tNUM tEOL
{ struct name_hash
*nh
;
227 DBG_ADDR addr
= { NULL
,
228 CS_reg
(&DEBUG_context
),
229 EIP_reg
(&DEBUG_context
) };
231 DBG_FIX_ADDR_SEG
( &addr
, CS_reg
(&DEBUG_context
) );
232 DEBUG_FindNearestSymbol
(&addr
, TRUE
,
236 DEBUG_GetLineNumberAddr
(nh
,
238 DEBUG_AddBreakpoint
( &addr
);
242 fprintf
(stderr
,"Unable to add breakpoint\n");
246 | tBREAK tEOL
{ DBG_ADDR addr
= { NULL
,
247 CS_reg
(&DEBUG_context
),
248 EIP_reg
(&DEBUG_context
) };
249 DEBUG_AddBreakpoint
( &addr
);
253 tINFO tBREAK tEOL
{ DEBUG_InfoBreakpoints
(); }
254 | tINFO tCLASS expr_value tEOL
{ CLASS_DumpClass
( (CLASS
*)$3 );
255 DEBUG_FreeExprMem
(); }
256 | tINFO tSHARE tEOL
{ DEBUG_InfoShare
(); }
257 | tINFO tMODULE expr_value tEOL
{ NE_DumpModule
( $3 );
258 DEBUG_FreeExprMem
(); }
259 | tINFO tQUEUE expr_value tEOL
{ QUEUE_DumpQueue
( $3 );
260 DEBUG_FreeExprMem
(); }
261 | tINFO tREGS tEOL
{ DEBUG_InfoRegisters
(); }
262 | tINFO tSEGMENTS expr_value tEOL
{ LDT_Print
( SELECTOR_TO_ENTRY
($3), 1 );
263 DEBUG_FreeExprMem
(); }
264 | tINFO tSEGMENTS tEOL
{ LDT_Print
( 0, -1 ); }
265 | tINFO tSTACK tEOL
{ DEBUG_InfoStack
(); }
266 | tINFO tMAPS tEOL
{ VIRTUAL_Dump
(); }
267 | tINFO tWND expr_value tEOL
{ WIN_DumpWindow
( $3 );
268 DEBUG_FreeExprMem
(); }
269 | tINFO tLOCAL tEOL
{ DEBUG_InfoLocals
(); }
270 | tINFO tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
273 tWALK tCLASS tEOL
{ CLASS_WalkClasses
(); }
274 | tWALK tMODULE tEOL
{ NE_WalkModules
(); }
275 | tWALK tQUEUE tEOL
{ QUEUE_WalkQueues
(); }
276 | tWALK tWND tEOL
{ WIN_WalkWindows
( 0, 0 ); }
277 | tWALK tWND tNUM tEOL
{ WIN_WalkWindows
( $3, 0 ); }
281 '(' type_expr
')' { $$
= $2; }
284 type_expr
'*' { $$
= DEBUG_FindOrMakePointerType
($1); }
285 | tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "int"); }
286 | tCHAR
{ $$
= DEBUG_TypeCast
(BASIC
, "char"); }
287 | tLONG tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "long int"); }
288 | tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "unsigned int"); }
289 | tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "long unsigned int"); }
290 | tLONG tLONG tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "long long int"); }
291 | tLONG tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "long long unsigned int"); }
292 | tSHORT tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "short int"); }
293 | tSHORT tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(BASIC
, "short unsigned int"); }
294 | tSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(BASIC
, "signed char"); }
295 | tUNSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(BASIC
, "unsigned char"); }
296 | tFLOAT
{ $$
= DEBUG_TypeCast
(BASIC
, "float"); }
297 | tDOUBLE
{ $$
= DEBUG_TypeCast
(BASIC
, "double"); }
298 | tLONG tDOUBLE
{ $$
= DEBUG_TypeCast
(BASIC
, "long double"); }
299 | tSTRUCT tIDENTIFIER
{ $$
= DEBUG_TypeCast
(STRUCT
, $2); }
300 | tUNION tIDENTIFIER
{ $$
= DEBUG_TypeCast
(STRUCT
, $2); }
301 | tENUM tIDENTIFIER
{ $$
= DEBUG_TypeCast
(ENUM
, $2); }
304 expr
{ $$
= DEBUG_EvalExpr
($1); }
307 expr
{ DBG_ADDR addr
= DEBUG_EvalExpr
($1);
308 $$
= addr.off ?
*(unsigned int *) addr.off
: 0; }
310 * The expr rule builds an expression tree. When we are done, we call
311 * EvalExpr to evaluate the value of the expression. The advantage of
312 * the two-step approach is that it is possible to save expressions for
313 * use in 'display' commands, and in conditional watchpoints.
316 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
317 | tSTRING
{ $$
= DEBUG_StringExpr
($1); }
318 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
319 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
320 | expr OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
321 | expr
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
322 | tIDENTIFIER
'(' ')' { $$
= DEBUG_CallExpr
($1, 0); }
323 | tIDENTIFIER
'(' expr
')' { $$
= DEBUG_CallExpr
($1, 1, $3); }
324 | tIDENTIFIER
'(' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 2, $3,
326 | tIDENTIFIER
'(' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7); }
327 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9); }
328 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9, $11); }
329 | expr
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
330 | expr
':' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SEG
, $1, $3); }
331 | expr OP_LOR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LOR
, $1, $3); }
332 | expr OP_LAND expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LAND
, $1, $3); }
333 | expr
'|' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_OR
, $1, $3); }
334 | expr
'&' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_AND
, $1, $3); }
335 | expr
'^' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_XOR
, $1, $3); }
336 | expr OP_EQ expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_EQ
, $1, $3); }
337 | expr
'>' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GT
, $1, $3); }
338 | expr
'<' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LT
, $1, $3); }
339 | expr OP_GE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GE
, $1, $3); }
340 | expr OP_LE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LE
, $1, $3); }
341 | expr OP_NE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_NE
, $1, $3); }
342 | expr OP_SHL expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHL
, $1, $3); }
343 | expr OP_SHR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHR
, $1, $3); }
344 | expr
'+' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_ADD
, $1, $3); }
345 | expr
'-' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SUB
, $1, $3); }
346 | expr
'*' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_MUL
, $1, $3); }
347 | expr
'/' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_DIV
, $1, $3); }
348 | expr
'%' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_REM
, $1, $3); }
349 |
'-' expr %prec OP_SIGN
{ $$
= DEBUG_UnopExpr
(EXP_OP_NEG
, $2); }
350 |
'+' expr %prec OP_SIGN
{ $$
= $2; }
351 |
'!' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_NOT
, $2); }
352 |
'~' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_LNOT
, $2); }
353 |
'(' expr
')' { $$
= $2; }
354 |
'*' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_DEREF
, $2); }
355 |
'&' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_ADDR
, $2); }
356 | type_cast expr %prec OP_DEREF
{ $$
= DEBUG_TypeCastExpr
($1, $2); }
359 * The lvalue rule builds an expression tree. This is a limited form
360 * of expression that is suitable to be used as an lvalue.
363 lval
{ $$
= DEBUG_EvalExpr
($1); }
367 |
'*' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_FORCE_DEREF
, $2); }
370 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
371 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
372 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
373 | lvalue OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
374 | lvalue
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
375 | lvalue
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
381 #ifdef DONT_USE_READLINE
382 fprintf
(stderr
,"Wine-dbg>");
386 void mode_command
(int newmode
)
388 if
((newmode
== 16) ||
(newmode
== 32)) dbg_mode
= newmode
;
389 else fprintf
(stderr
,"Invalid mode (use 16 or 32)\n");
393 /***********************************************************************
396 * Debugger main loop.
398 static void DEBUG_Main
( int signal
)
400 static int loaded_symbols
= 0;
401 static BOOL32 in_debugger
= FALSE
;
402 char SymbolTableFile
[256];
411 fprintf
( stderr
, "Segmentation fault inside debugger, exiting.\n" );
417 DEBUG_SetBreakpoints
( FALSE
);
424 * Initialize the type handling stuff.
429 * In some cases we can read the stabs information directly
430 * from the executable. If this is the case, we don't need
431 * to bother with trying to read a symbol file, as the stabs
432 * also have line number and local variable information.
433 * As long as gcc is used for the compiler, stabs will
434 * be the default. On SVr4, DWARF could be used, but we
435 * don't grok that yet, and in this case we fall back to using
438 fprintf
(stderr
,"Loading symbols: ");
439 if
( DEBUG_ReadExecutableDbgInfo
() == FALSE
)
441 char *symfilename
= "wine.sym";
443 if
(-1 == stat
(symfilename
, &statbuf
) )
444 symfilename
= LIBDIR
"wine.sym";
446 PROFILE_GetWineIniString
( "wine", "SymbolTableFile", symfilename
,
447 SymbolTableFile
, sizeof
(SymbolTableFile
));
448 DEBUG_ReadSymbolTable
( SymbolTableFile
);
451 DEBUG_LoadEntryPoints
();
452 DEBUG_ProcessDeferredDebug
();
453 fprintf
(stderr
,"\n");
457 fprintf
(stderr
, "Entering debugger PC=%x, mode=%d, count=%d\n",
458 EIP_reg
(&DEBUG_context
),
459 dbg_exec_mode
, dbg_exec_count
);
464 if
((signal
!= SIGTRAP
) ||
!DEBUG_ShouldContinue
( dbg_exec_mode
,
469 addr.seg
= CS_reg
(&DEBUG_context
);
470 addr.off
= EIP_reg
(&DEBUG_context
);
472 DBG_FIX_ADDR_SEG
( &addr
, 0 );
474 /* Put the display in a correct state */
476 XUngrabPointer
( display
, CurrentTime
);
477 XUngrabServer
( display
);
480 newmode
= IS_SELECTOR_32BIT
(addr.seg
) ?
32 : 16;
481 if
(newmode
!= dbg_mode
)
482 fprintf
(stderr
,"In %d bit mode.\n", dbg_mode
= newmode
);
486 if
(signal
!= SIGTRAP
) /* This is a real crash, dump some info */
488 DEBUG_InfoRegisters
();
492 LDT_Print
( SELECTOR_TO_ENTRY
(DS_reg
(&DEBUG_context
)), 1 );
493 if
(ES_reg
(&DEBUG_context
) != DS_reg
(&DEBUG_context
))
494 LDT_Print
( SELECTOR_TO_ENTRY
(ES_reg
(&DEBUG_context
)), 1 );
501 * Do a quiet backtrace so that we have an idea of what the situation
502 * is WRT the source files.
504 DEBUG_SilentBackTrace
();
507 if
((signal
!= SIGTRAP
) ||
508 (dbg_exec_mode
== EXEC_STEPI_OVER
) ||
509 (dbg_exec_mode
== EXEC_STEPI_INSTR
))
511 /* Show where we crashed */
513 DEBUG_PrintAddress
( &addr
, dbg_mode
, TRUE
);
514 fprintf
(stderr
,": ");
515 if
(DBG_CHECK_READ_PTR
( &addr
, 1 ))
517 DEBUG_Disasm
( &addr
, TRUE
);
518 fprintf
(stderr
,"\n");
528 addr.seg
= CS_reg
(&DEBUG_context
);
529 addr.off
= EIP_reg
(&DEBUG_context
);
530 DBG_FIX_ADDR_SEG
( &addr
, 0 );
531 ret_ok
= DEBUG_ValidateRegisters
();
532 if
(ret_ok
) ret_ok
= DBG_CHECK_READ_PTR
( &addr
, 1 );
536 dbg_exec_mode
= DEBUG_RestartExecution
( dbg_exec_mode
, dbg_exec_count
);
538 * This will have gotten absorbed into the breakpoint info
539 * if it was used. Otherwise it would have been ignored.
540 * In any case, we don't mess with it any more.
542 if
( dbg_exec_mode
== EXEC_CONT
)
551 /***********************************************************************
552 * DebugBreak32 (KERNEL32)
554 void DebugBreak32
( CONTEXT
*regs
)
556 const char *module
= MODULE_GetModuleName
( GetCurrentTask
() );
557 fprintf
( stderr
, "%s called DebugBreak\n", module ? module
: "???" );
558 DEBUG_context
= *regs
;
559 DEBUG_Main
( SIGTRAP
);
562 /***********************************************************************
563 * DebugBreak16 (KERNEL.203)
565 void DebugBreak16
( CONTEXT
*regs
)
567 const char *module
= MODULE_GetModuleName
( GetCurrentTask
() );
568 fprintf
( stderr
, "%s called DebugBreak\n", module ? module
: "???" );
569 DEBUG_context
= *regs
;
570 DEBUG_Main
( SIGTRAP
);
574 void wine_debug
( int signal
, SIGCONTEXT
*regs
)
576 DEBUG_SetSigContext
( regs
);
578 DWORD
*stack
= (DWORD
*)ESP_reg
(&DEBUG_context
);
581 *(--stack
) = EH_NONCONTINUABLE
;
582 *(--stack
) = EXCEPTION_ACCESS_VIOLATION
;
583 *(--stack
) = EIP_reg
(&DEBUG_context
);
584 ESP_reg
(&DEBUG_context
) = (DWORD
)stack
;
585 EIP_reg
(&DEBUG_context
) = GetProcAddress32
( GetModuleHandle
("KERNEL32"),
588 DEBUG_Main
( signal
);
589 DEBUG_GetSigContext
( regs
);
592 int yyerror(char * s
)
594 fprintf
(stderr
,"%s\n", s
);