3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
31 unsigned int dbg_mode
= 0;
34 static enum exec_mode dbg_exec_mode
= EXEC_CONT
;
35 static int dbg_exec_count
= 0;
37 void issue_prompt
(void);
38 void mode_command
(int);
39 void flush_symbols
(void);
43 extern
void VIRTUAL_Dump
(void); /* memory/virtual.c */
53 struct list_id listing
;
54 struct expr
* expression
;
55 struct datatype
* type
;
58 %token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
59 %token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT
60 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
62 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
63 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
65 %token
<string> tIDENTIFIER tSTRING
66 %token
<integer
> tNUM tFORMAT
69 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
70 %token tSTRUCT tUNION tENUM
73 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
74 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
75 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
76 /* %left OP_COND */ /* ... ? ... : ... */
83 %left
'<' '>' OP_LE OP_GE
87 %left OP_SIGN
'!' '~' OP_DEREF
/* OP_INC OP_DEC OP_ADDR */
91 %type
<expression
> expr lval lvalue
92 %type
<type
> type_cast type_expr
93 %type
<address
> expr_addr lval_addr
94 %type
<integer
> expr_value
95 %type
<string> pathname
97 %type
<listing
> list_arg
101 input: line
{ issue_prompt
(); }
102 | input line
{ issue_prompt
(); }
106 |
error tEOL
{ yyerrok; }
109 tQUIT tEOL
{ exit
(0); }
110 | tHELP tEOL
{ DEBUG_Help
(); }
111 | tHELP tINFO tEOL
{ DEBUG_HelpInfo
(); }
112 | tCONT tEOL
{ dbg_exec_count
= 1;
113 dbg_exec_mode
= EXEC_CONT
; return
0; }
114 | tCONT tNUM tEOL
{ dbg_exec_count
= $2;
115 dbg_exec_mode
= EXEC_CONT
; return
0; }
116 | tSTEP tEOL
{ dbg_exec_count
= 1;
117 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
118 | tNEXT tEOL
{ dbg_exec_count
= 1;
119 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
120 | tSTEP tNUM tEOL
{ dbg_exec_count
= $2;
121 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
122 | tNEXT tNUM tEOL
{ dbg_exec_count
= $2;
123 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
124 | tSTEPI tEOL
{ dbg_exec_count
= 1;
125 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
126 | tNEXTI tEOL
{ dbg_exec_count
= 1;
127 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
128 | tSTEPI tNUM tEOL
{ dbg_exec_count
= $2;
129 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
130 | tNEXTI tNUM tEOL
{ dbg_exec_count
= $2;
131 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
132 | tABORT tEOL
{ kill
(getpid
(), SIGABRT
); }
133 | tMODE tNUM tEOL
{ mode_command
($2); }
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
(); }
138 | tUP tEOL
{ DEBUG_SetFrame
( curr_frame
+ 1 ); }
139 | tUP tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
+ $2 ); }
140 | tDOWN tEOL
{ DEBUG_SetFrame
( curr_frame
- 1 ); }
141 | tDOWN tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
- $2 ); }
142 | tFRAME tNUM tEOL
{ DEBUG_SetFrame
( $2 ); }
143 | tFINISH tEOL
{ dbg_exec_count
= 0;
144 dbg_exec_mode
= EXEC_FINISH
; return
0; }
145 | tSHOW tDIR tEOL
{ DEBUG_ShowDir
(); }
146 | tDIR pathname tEOL
{ DEBUG_AddPath
( $2 ); }
147 | tDIR tEOL
{ DEBUG_NukePath
(); }
148 | tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
149 | tDISPLAY expr tEOL
{ DEBUG_AddDisplay
($2, 1, 0); }
150 | tDISPLAY tFORMAT expr tEOL
{ DEBUG_AddDisplay
($3, $2 >> 8, $2 & 0xff); }
151 | tDELETE tDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $3 ); }
152 | tDELETE tDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
153 | tUNDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $2 ); }
154 | tUNDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
155 | tCOND tNUM tEOL
{ DEBUG_AddBPCondition
($2, NULL
); }
156 | tCOND tNUM expr tEOL
{ DEBUG_AddBPCondition
($2, $3); }
158 | disassemble_command
167 tSET tREG
'=' expr_value tEOL
{ DEBUG_SetRegister
( $2, $4 );
168 DEBUG_FreeExprMem
(); }
169 | tSET lval_addr
'=' expr_value tEOL
{ DEBUG_WriteMemory
( &$2, $4 );
170 DEBUG_FreeExprMem
(); }
173 tIDENTIFIER
{ $$
= $1; }
177 tDISASSEMBLE tEOL
{ DEBUG_Disassemble
( NULL
, NULL
, 10 ); }
178 | tDISASSEMBLE expr_addr tEOL
{ DEBUG_Disassemble
( & $2, NULL
, 10 ); }
179 | tDISASSEMBLE expr_addr
',' expr_addr tEOL
{ DEBUG_Disassemble
( & $2, & $4, 0 ); }
182 tLIST tEOL
{ DEBUG_List
( NULL
, NULL
, 10 ); }
183 | tLIST
'-' tEOL
{ DEBUG_List
( NULL
, NULL
, -10 ); }
184 | tLIST list_arg tEOL
{ DEBUG_List
( & $2, NULL
, 10 ); }
185 | tLIST
',' list_arg tEOL
{ DEBUG_List
( NULL
, & $3, -10 ); }
186 | tLIST list_arg
',' list_arg tEOL
{ DEBUG_List
( & $2, & $4, 0 ); }
189 tNUM
{ $$.sourcefile
= NULL
; $$.line
= $1; }
190 | pathname
':' tNUM
{ $$.sourcefile
= $1; $$.line
= $3; }
191 | tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, NULL
, $1); }
192 | pathname
':' tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, $1, $3); }
193 |
'*' expr_addr
{ DEBUG_FindNearestSymbol
( & $2, FALSE
, NULL
,
195 DEBUG_FreeExprMem
(); }
198 tEXAM expr_addr tEOL
{ DEBUG_ExamineMemory
( &$2, 1, 'x');
199 DEBUG_FreeExprMem
(); }
200 | tEXAM tFORMAT expr_addr tEOL
{ DEBUG_ExamineMemory
( &$3, $2>>8, $2&0xff );
201 DEBUG_FreeExprMem
(); }
204 tPRINT expr_addr tEOL
{ DEBUG_Print
( &$2, 1, 0, 0 );
205 DEBUG_FreeExprMem
(); }
206 | tPRINT tFORMAT expr_addr tEOL
{ DEBUG_Print
( &$3, $2 >> 8, $2 & 0xff, 0 );
207 DEBUG_FreeExprMem
(); }
210 tBREAK
'*' expr_addr tEOL
{ DEBUG_AddBreakpoint
( &$3 );
211 DEBUG_FreeExprMem
(); }
212 | tBREAK tIDENTIFIER tEOL
{ DBG_ADDR addr
;
213 if
( DEBUG_GetSymbolValue
($2, -1, &addr
, TRUE
) )
215 DEBUG_AddBreakpoint
( &addr
);
219 fprintf
(stderr
,"Unable to add breakpoint\n");
222 | tBREAK tIDENTIFIER
':' tNUM tEOL
{ DBG_ADDR addr
;
223 if
( DEBUG_GetSymbolValue
($2, $4, &addr
, TRUE
) )
225 DEBUG_AddBreakpoint
( &addr
);
229 fprintf
(stderr
,"Unable to add breakpoint\n");
232 | tBREAK tNUM tEOL
{ struct name_hash
*nh
;
233 DBG_ADDR addr
= { NULL
,
234 CS_reg
(&DEBUG_context
),
235 EIP_reg
(&DEBUG_context
) };
236 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
237 if
(ISV86
(&DEBUG_context
))
238 addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
239 DBG_FIX_ADDR_SEG
( &addr
, CS_reg
(&DEBUG_context
) );
240 GlobalUnlock16
( GetCurrentTask
() );
241 DEBUG_FindNearestSymbol
(&addr
, TRUE
,
245 DEBUG_GetLineNumberAddr
(nh
,
247 DEBUG_AddBreakpoint
( &addr
);
251 fprintf
(stderr
,"Unable to add breakpoint\n");
255 | tBREAK tEOL
{ DBG_ADDR addr
= { NULL
,
256 CS_reg
(&DEBUG_context
),
257 EIP_reg
(&DEBUG_context
) };
258 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
259 if
(ISV86
(&DEBUG_context
))
260 addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
261 GlobalUnlock16
( GetCurrentTask
() );
262 DEBUG_AddBreakpoint
( &addr
);
266 tINFO tBREAK tEOL
{ DEBUG_InfoBreakpoints
(); }
267 | tINFO tCLASS expr_value tEOL
{ CLASS_DumpClass
( (CLASS
*)$3 );
268 DEBUG_FreeExprMem
(); }
269 | tINFO tSHARE tEOL
{ DEBUG_InfoShare
(); }
270 | tINFO tMODULE expr_value tEOL
{ NE_DumpModule
( $3 );
271 DEBUG_FreeExprMem
(); }
272 | tINFO tQUEUE expr_value tEOL
{ QUEUE_DumpQueue
( $3 );
273 DEBUG_FreeExprMem
(); }
274 | tINFO tREGS tEOL
{ DEBUG_InfoRegisters
(); }
275 | tINFO tSEGMENTS expr_value tEOL
{ LDT_Print
( SELECTOR_TO_ENTRY
($3), 1 );
276 DEBUG_FreeExprMem
(); }
277 | tINFO tSEGMENTS tEOL
{ LDT_Print
( 0, -1 ); }
278 | tINFO tSTACK tEOL
{ DEBUG_InfoStack
(); }
279 | tINFO tMAPS tEOL
{ VIRTUAL_Dump
(); }
280 | tINFO tWND expr_value tEOL
{ WIN_DumpWindow
( $3 );
281 DEBUG_FreeExprMem
(); }
282 | tINFO tLOCAL tEOL
{ DEBUG_InfoLocals
(); }
283 | tINFO tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
286 tWALK tCLASS tEOL
{ CLASS_WalkClasses
(); }
287 | tWALK tMODULE tEOL
{ NE_WalkModules
(); }
288 | tWALK tQUEUE tEOL
{ QUEUE_WalkQueues
(); }
289 | tWALK tWND tEOL
{ WIN_WalkWindows
( 0, 0 ); }
290 | tWALK tWND tNUM tEOL
{ WIN_WalkWindows
( $3, 0 ); }
294 '(' type_expr
')' { $$
= $2; }
297 type_expr
'*' { $$
= DEBUG_FindOrMakePointerType
($1); }
298 | tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "int"); }
299 | tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "char"); }
300 | tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long int"); }
301 | tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned int"); }
302 | tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long unsigned int"); }
303 | tLONG tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long int"); }
304 | tLONG tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long unsigned int"); }
305 | tSHORT tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short int"); }
306 | tSHORT tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short unsigned int"); }
307 | tSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "signed char"); }
308 | tUNSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned char"); }
309 | tFLOAT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "float"); }
310 | tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "double"); }
311 | tLONG tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long double"); }
312 | tSTRUCT tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
313 | tUNION tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
314 | tENUM tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_ENUM
, $2); }
317 expr
{ $$
= DEBUG_EvalExpr
($1); }
320 expr
{ DBG_ADDR addr
= DEBUG_EvalExpr
($1);
321 $$
= addr.off ?
*(unsigned int *) addr.off
: 0; }
323 * The expr rule builds an expression tree. When we are done, we call
324 * EvalExpr to evaluate the value of the expression. The advantage of
325 * the two-step approach is that it is possible to save expressions for
326 * use in 'display' commands, and in conditional watchpoints.
329 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
330 | tSTRING
{ $$
= DEBUG_StringExpr
($1); }
331 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
332 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
333 | expr OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
334 | expr
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
335 | tIDENTIFIER
'(' ')' { $$
= DEBUG_CallExpr
($1, 0); }
336 | tIDENTIFIER
'(' expr
')' { $$
= DEBUG_CallExpr
($1, 1, $3); }
337 | tIDENTIFIER
'(' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 2, $3,
339 | tIDENTIFIER
'(' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7); }
340 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9); }
341 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9, $11); }
342 | expr
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
343 | expr
':' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SEG
, $1, $3); }
344 | expr OP_LOR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LOR
, $1, $3); }
345 | expr OP_LAND expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LAND
, $1, $3); }
346 | expr
'|' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_OR
, $1, $3); }
347 | expr
'&' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_AND
, $1, $3); }
348 | expr
'^' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_XOR
, $1, $3); }
349 | expr OP_EQ expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_EQ
, $1, $3); }
350 | expr
'>' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GT
, $1, $3); }
351 | expr
'<' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LT
, $1, $3); }
352 | expr OP_GE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GE
, $1, $3); }
353 | expr OP_LE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LE
, $1, $3); }
354 | expr OP_NE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_NE
, $1, $3); }
355 | expr OP_SHL expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHL
, $1, $3); }
356 | expr OP_SHR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHR
, $1, $3); }
357 | expr
'+' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_ADD
, $1, $3); }
358 | expr
'-' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SUB
, $1, $3); }
359 | expr
'*' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_MUL
, $1, $3); }
360 | expr
'/' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_DIV
, $1, $3); }
361 | expr
'%' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_REM
, $1, $3); }
362 |
'-' expr %prec OP_SIGN
{ $$
= DEBUG_UnopExpr
(EXP_OP_NEG
, $2); }
363 |
'+' expr %prec OP_SIGN
{ $$
= $2; }
364 |
'!' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_NOT
, $2); }
365 |
'~' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_LNOT
, $2); }
366 |
'(' expr
')' { $$
= $2; }
367 |
'*' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_DEREF
, $2); }
368 |
'&' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_ADDR
, $2); }
369 | type_cast expr %prec OP_DEREF
{ $$
= DEBUG_TypeCastExpr
($1, $2); }
372 * The lvalue rule builds an expression tree. This is a limited form
373 * of expression that is suitable to be used as an lvalue.
376 lval
{ $$
= DEBUG_EvalExpr
($1); }
380 |
'*' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_FORCE_DEREF
, $2); }
383 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
384 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
385 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
386 | lvalue OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
387 | lvalue
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
388 | lvalue
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
394 #ifdef DONT_USE_READLINE
395 fprintf
(stderr
,"Wine-dbg>");
399 void mode_command
(int newmode
)
401 if
((newmode
== 16) ||
(newmode
== 32)) dbg_mode
= newmode
;
402 else fprintf
(stderr
,"Invalid mode (use 16 or 32)\n");
406 /***********************************************************************
409 * Debugger main loop.
411 static void DEBUG_Main
( int signal
)
413 static int loaded_symbols
= 0;
414 static BOOL32 in_debugger
= FALSE
;
415 char SymbolTableFile
[256];
424 fprintf
( stderr
, "Segmentation fault inside debugger, exiting.\n" );
430 DEBUG_SetBreakpoints
( FALSE
);
437 * Initialize the type handling stuff.
442 * In some cases we can read the stabs information directly
443 * from the executable. If this is the case, we don't need
444 * to bother with trying to read a symbol file, as the stabs
445 * also have line number and local variable information.
446 * As long as gcc is used for the compiler, stabs will
447 * be the default. On SVr4, DWARF could be used, but we
448 * don't grok that yet, and in this case we fall back to using
451 if
( DEBUG_ReadExecutableDbgInfo
() == FALSE
)
453 char *symfilename
= "wine.sym";
455 if
(-1 == stat
(symfilename
, &statbuf
) )
456 symfilename
= LIBDIR
"wine.sym";
458 PROFILE_GetWineIniString
( "wine", "SymbolTableFile", symfilename
,
459 SymbolTableFile
, sizeof
(SymbolTableFile
));
460 DEBUG_ReadSymbolTable
( SymbolTableFile
);
463 DEBUG_LoadEntryPoints
();
464 DEBUG_ProcessDeferredDebug
();
468 fprintf
(stderr
, "Entering debugger PC=%x, mode=%d, count=%d\n",
469 EIP_reg
(&DEBUG_context
),
470 dbg_exec_mode
, dbg_exec_count
);
475 if
((signal
!= SIGTRAP
) ||
!DEBUG_ShouldContinue
( dbg_exec_mode
,
479 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
481 addr.seg
= CS_reg
(&DEBUG_context
);
482 addr.off
= EIP_reg
(&DEBUG_context
);
483 if
(ISV86
(&DEBUG_context
)) addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
485 DBG_FIX_ADDR_SEG
( &addr
, 0 );
487 GlobalUnlock16
( GetCurrentTask
() );
489 /* Put the display in a correct state */
491 TSXUngrabServer
( display
);
494 newmode
= ISV86
(&DEBUG_context
) ?
16 : IS_SELECTOR_32BIT
(addr.seg
) ?
32 : 16;
495 if
(newmode
!= dbg_mode
)
496 fprintf
(stderr
,"In %d bit mode.\n", dbg_mode
= newmode
);
498 PROCESS_SuspendOtherThreads
();
502 if
(signal
!= SIGTRAP
) /* This is a real crash, dump some info */
504 DEBUG_InfoRegisters
();
508 LDT_Print
( SELECTOR_TO_ENTRY
(DS_reg
(&DEBUG_context
)), 1 );
509 if
(ES_reg
(&DEBUG_context
) != DS_reg
(&DEBUG_context
))
510 LDT_Print
( SELECTOR_TO_ENTRY
(ES_reg
(&DEBUG_context
)), 1 );
517 * Do a quiet backtrace so that we have an idea of what the situation
518 * is WRT the source files.
520 DEBUG_SilentBackTrace
();
523 if
((signal
!= SIGTRAP
) ||
524 (dbg_exec_mode
== EXEC_STEPI_OVER
) ||
525 (dbg_exec_mode
== EXEC_STEPI_INSTR
))
527 /* Show where we crashed */
529 DEBUG_PrintAddress
( &addr
, dbg_mode
, TRUE
);
530 fprintf
(stderr
,": ");
531 if
(DBG_CHECK_READ_PTR
( &addr
, 1 ))
533 DEBUG_Disasm
( &addr
, TRUE
);
534 fprintf
(stderr
,"\n");
544 addr.seg
= CS_reg
(&DEBUG_context
) |
(addr.seg
&0xffff0000);
545 addr.off
= EIP_reg
(&DEBUG_context
);
546 DBG_FIX_ADDR_SEG
( &addr
, 0 );
547 ret_ok
= DEBUG_ValidateRegisters
();
548 if
(ret_ok
) ret_ok
= DBG_CHECK_READ_PTR
( &addr
, 1 );
552 dbg_exec_mode
= DEBUG_RestartExecution
( dbg_exec_mode
, dbg_exec_count
);
554 * This will have gotten absorbed into the breakpoint info
555 * if it was used. Otherwise it would have been ignored.
556 * In any case, we don't mess with it any more.
558 if
( dbg_exec_mode
== EXEC_CONT
)
561 PROCESS_ResumeOtherThreads
();
569 /***********************************************************************
570 * DebugBreak (KERNEL.203) (KERNEL32.181)
572 void DebugBreak
( CONTEXT
*regs
)
575 if
(!GetModuleName
( GetCurrentTask
(), module
, sizeof
(module
) ))
576 strcpy
( module
, "???" );
577 fprintf
( stderr
, "%s called DebugBreak\n", module
);
578 DEBUG_context
= *regs
;
579 DEBUG_Main
( SIGTRAP
);
583 void ctx_debug
( int signal
, CONTEXT
*regs
)
585 DEBUG_context
= *regs
;
586 DEBUG_Main
( signal
);
587 *regs
= DEBUG_context
;
590 void wine_debug
( int signal
, SIGCONTEXT
*regs
)
593 DWORD
*stack
= (DWORD
*)ESP_sig
(regs
);
596 *(--stack
) = EH_NONCONTINUABLE
;
597 *(--stack
) = EXCEPTION_ACCESS_VIOLATION
;
598 *(--stack
) = EIP_sig
(regs
);
599 ESP_sig
(regs
) = (DWORD
)stack
;
600 EIP_sig
(regs
) = (DWORD
)RaiseException
;
602 DEBUG_SetSigContext
( regs
);
603 DEBUG_Main
( signal
);
604 DEBUG_GetSigContext
( regs
);
608 int yyerror(char * s
)
610 fprintf
(stderr
,"%s\n", s
);