3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
32 unsigned int dbg_mode
= 0;
35 static enum exec_mode dbg_exec_mode
= EXEC_CONT
;
36 static int dbg_exec_count
= 0;
38 void issue_prompt
(void);
39 void mode_command
(int);
40 void flush_symbols
(void);
44 extern
void VIRTUAL_Dump
(void); /* memory/virtual.c */
54 struct list_id listing
;
55 struct expr
* expression
;
56 struct datatype
* type
;
59 %token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
60 %token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT tDEBUGMSG
61 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
62 %token tEOL tSTRING tDEBUGSTR
63 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
64 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
66 %token
<string> tIDENTIFIER tSTRING tDEBUGSTR
67 %token
<integer
> tNUM tFORMAT
71 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
72 %token tSTRUCT tUNION tENUM
75 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
76 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
77 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
78 /* %left OP_COND */ /* ... ? ... : ... */
85 %left
'<' '>' OP_LE OP_GE
89 %left OP_SIGN
'!' '~' OP_DEREF
/* OP_INC OP_DEC OP_ADDR */
93 %type
<expression
> expr lval lvalue
94 %type
<type
> type_cast type_expr
95 %type
<address
> expr_addr lval_addr
96 %type
<integer
> expr_value
97 %type
<string> pathname
99 %type
<listing
> list_arg
103 input: line
{ issue_prompt
(); }
104 | input line
{ issue_prompt
(); }
108 |
error tEOL
{ yyerrok; }
111 tQUIT tEOL
{ exit
(0); }
112 | tHELP tEOL
{ DEBUG_Help
(); }
113 | tHELP tINFO tEOL
{ DEBUG_HelpInfo
(); }
114 | tCONT tEOL
{ dbg_exec_count
= 1;
115 dbg_exec_mode
= EXEC_CONT
; return
0; }
116 | tCONT tNUM tEOL
{ dbg_exec_count
= $2;
117 dbg_exec_mode
= EXEC_CONT
; return
0; }
118 | tSTEP tEOL
{ dbg_exec_count
= 1;
119 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
120 | tNEXT tEOL
{ dbg_exec_count
= 1;
121 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
122 | tSTEP tNUM tEOL
{ dbg_exec_count
= $2;
123 dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
124 | tNEXT tNUM tEOL
{ dbg_exec_count
= $2;
125 dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
126 | tSTEPI tEOL
{ dbg_exec_count
= 1;
127 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
128 | tNEXTI tEOL
{ dbg_exec_count
= 1;
129 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
130 | tSTEPI tNUM tEOL
{ dbg_exec_count
= $2;
131 dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
132 | tNEXTI tNUM tEOL
{ dbg_exec_count
= $2;
133 dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
134 | tABORT tEOL
{ kill
(getpid
(), SIGABRT
); }
135 | tMODE tNUM tEOL
{ mode_command
($2); }
136 | tENABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, TRUE
); }
137 | tDISABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, FALSE
); }
138 | tDELETE tBREAK tNUM tEOL
{ DEBUG_DelBreakpoint
( $3 ); }
139 | tBACKTRACE tEOL
{ DEBUG_BackTrace
(); }
140 | tUP tEOL
{ DEBUG_SetFrame
( curr_frame
+ 1 ); }
141 | tUP tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
+ $2 ); }
142 | tDOWN tEOL
{ DEBUG_SetFrame
( curr_frame
- 1 ); }
143 | tDOWN tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
- $2 ); }
144 | tFRAME tNUM tEOL
{ DEBUG_SetFrame
( $2 ); }
145 | tFINISH tEOL
{ dbg_exec_count
= 0;
146 dbg_exec_mode
= EXEC_FINISH
; return
0; }
147 | tSHOW tDIR tEOL
{ DEBUG_ShowDir
(); }
148 | tDIR pathname tEOL
{ DEBUG_AddPath
( $2 ); }
149 | tDIR tEOL
{ DEBUG_NukePath
(); }
150 | tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
151 | tDISPLAY expr tEOL
{ DEBUG_AddDisplay
($2, 1, 0); }
152 | tDISPLAY tFORMAT expr tEOL
{ DEBUG_AddDisplay
($3, $2 >> 8, $2 & 0xff); }
153 | tDELETE tDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $3 ); }
154 | tDELETE tDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
155 | tUNDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $2 ); }
156 | tUNDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
157 | tCOND tNUM tEOL
{ DEBUG_AddBPCondition
($2, NULL
); }
158 | tCOND tNUM expr tEOL
{ DEBUG_AddBPCondition
($2, $3); }
159 | tDEBUGMSG tDEBUGSTR tEOL
{ MAIN_ParseDebugOptions
($2); }
160 | tSYMBOLFILE pathname tEOL
{ DEBUG_ReadSymbolTable
($2); }
162 | disassemble_command
171 tSET tREG
'=' expr_value tEOL
{ DEBUG_SetRegister
( $2, $4 );
172 DEBUG_FreeExprMem
(); }
173 | tSET lval_addr
'=' expr_value tEOL
{ DEBUG_WriteMemory
( &$2, $4 );
174 DEBUG_FreeExprMem
(); }
177 tIDENTIFIER
{ $$
= $1; }
181 tDISASSEMBLE tEOL
{ DEBUG_Disassemble
( NULL
, NULL
, 10 ); }
182 | tDISASSEMBLE expr_addr tEOL
{ DEBUG_Disassemble
( & $2, NULL
, 10 ); }
183 | tDISASSEMBLE expr_addr
',' expr_addr tEOL
{ DEBUG_Disassemble
( & $2, & $4, 0 ); }
186 tLIST tEOL
{ DEBUG_List
( NULL
, NULL
, 10 ); }
187 | tLIST
'-' tEOL
{ DEBUG_List
( NULL
, NULL
, -10 ); }
188 | tLIST list_arg tEOL
{ DEBUG_List
( & $2, NULL
, 10 ); }
189 | tLIST
',' list_arg tEOL
{ DEBUG_List
( NULL
, & $3, -10 ); }
190 | tLIST list_arg
',' list_arg tEOL
{ DEBUG_List
( & $2, & $4, 0 ); }
193 tNUM
{ $$.sourcefile
= NULL
; $$.line
= $1; }
194 | pathname
':' tNUM
{ $$.sourcefile
= $1; $$.line
= $3; }
195 | tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, NULL
, $1); }
196 | pathname
':' tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, $1, $3); }
197 |
'*' expr_addr
{ DEBUG_FindNearestSymbol
( & $2, FALSE
, NULL
,
199 DEBUG_FreeExprMem
(); }
202 tEXAM expr_addr tEOL
{ DEBUG_ExamineMemory
( &$2, 1, 'x');
203 DEBUG_FreeExprMem
(); }
204 | tEXAM tFORMAT expr_addr tEOL
{ DEBUG_ExamineMemory
( &$3, $2>>8, $2&0xff );
205 DEBUG_FreeExprMem
(); }
208 tPRINT expr_addr tEOL
{ DEBUG_Print
( &$2, 1, 0, 0 );
209 DEBUG_FreeExprMem
(); }
210 | tPRINT tFORMAT expr_addr tEOL
{ DEBUG_Print
( &$3, $2 >> 8, $2 & 0xff, 0 );
211 DEBUG_FreeExprMem
(); }
214 tBREAK
'*' expr_addr tEOL
{ DEBUG_AddBreakpoint
( &$3 );
215 DEBUG_FreeExprMem
(); }
216 | tBREAK tIDENTIFIER tEOL
{ DBG_ADDR addr
;
217 if
( DEBUG_GetSymbolValue
($2, -1, &addr
, TRUE
) )
219 DEBUG_AddBreakpoint
( &addr
);
223 fprintf
(stderr
,"Unable to add breakpoint\n");
226 | tBREAK tIDENTIFIER
':' tNUM tEOL
{ DBG_ADDR addr
;
227 if
( DEBUG_GetSymbolValue
($2, $4, &addr
, TRUE
) )
229 DEBUG_AddBreakpoint
( &addr
);
233 fprintf
(stderr
,"Unable to add breakpoint\n");
236 | tBREAK tNUM tEOL
{ struct name_hash
*nh
;
237 DBG_ADDR addr
= { NULL
,
238 CS_reg
(&DEBUG_context
),
239 EIP_reg
(&DEBUG_context
) };
240 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
241 if
(ISV86
(&DEBUG_context
))
242 addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
243 DBG_FIX_ADDR_SEG
( &addr
, CS_reg
(&DEBUG_context
) );
244 GlobalUnlock16
( GetCurrentTask
() );
245 DEBUG_FindNearestSymbol
(&addr
, TRUE
,
249 DEBUG_GetLineNumberAddr
(nh
,
251 DEBUG_AddBreakpoint
( &addr
);
255 fprintf
(stderr
,"Unable to add breakpoint\n");
259 | tBREAK tEOL
{ DBG_ADDR addr
= { NULL
,
260 CS_reg
(&DEBUG_context
),
261 EIP_reg
(&DEBUG_context
) };
262 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
263 if
(ISV86
(&DEBUG_context
))
264 addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
265 GlobalUnlock16
( GetCurrentTask
() );
266 DEBUG_AddBreakpoint
( &addr
);
270 tINFO tBREAK tEOL
{ DEBUG_InfoBreakpoints
(); }
271 | tINFO tCLASS expr_value tEOL
{ CLASS_DumpClass
( (CLASS
*)$3 );
272 DEBUG_FreeExprMem
(); }
273 | tINFO tSHARE tEOL
{ DEBUG_InfoShare
(); }
274 | tINFO tMODULE expr_value tEOL
{ NE_DumpModule
( $3 );
275 DEBUG_FreeExprMem
(); }
276 | tINFO tQUEUE expr_value tEOL
{ QUEUE_DumpQueue
( $3 );
277 DEBUG_FreeExprMem
(); }
278 | tINFO tREGS tEOL
{ DEBUG_InfoRegisters
(); }
279 | tINFO tSEGMENTS expr_value tEOL
{ LDT_Print
( SELECTOR_TO_ENTRY
($3), 1 );
280 DEBUG_FreeExprMem
(); }
281 | tINFO tSEGMENTS tEOL
{ LDT_Print
( 0, -1 ); }
282 | tINFO tSTACK tEOL
{ DEBUG_InfoStack
(); }
283 | tINFO tMAPS tEOL
{ VIRTUAL_Dump
(); }
284 | tINFO tWND expr_value tEOL
{ WIN_DumpWindow
( $3 );
285 DEBUG_FreeExprMem
(); }
286 | tINFO tLOCAL tEOL
{ DEBUG_InfoLocals
(); }
287 | tINFO tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
290 tWALK tCLASS tEOL
{ CLASS_WalkClasses
(); }
291 | tWALK tMODULE tEOL
{ NE_WalkModules
(); }
292 | tWALK tQUEUE tEOL
{ QUEUE_WalkQueues
(); }
293 | tWALK tWND tEOL
{ WIN_WalkWindows
( 0, 0 ); }
294 | tWALK tWND tNUM tEOL
{ WIN_WalkWindows
( $3, 0 ); }
298 '(' type_expr
')' { $$
= $2; }
301 type_expr
'*' { $$
= DEBUG_FindOrMakePointerType
($1); }
302 | tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "int"); }
303 | tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "char"); }
304 | tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long int"); }
305 | tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned int"); }
306 | tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long unsigned int"); }
307 | tLONG tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long int"); }
308 | tLONG tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long unsigned int"); }
309 | tSHORT tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short int"); }
310 | tSHORT tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short unsigned int"); }
311 | tSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "signed char"); }
312 | tUNSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned char"); }
313 | tFLOAT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "float"); }
314 | tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "double"); }
315 | tLONG tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long double"); }
316 | tSTRUCT tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
317 | tUNION tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
318 | tENUM tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_ENUM
, $2); }
321 expr
{ $$
= DEBUG_EvalExpr
($1); }
324 expr
{ DBG_ADDR addr
= DEBUG_EvalExpr
($1);
325 $$
= addr.off ?
*(unsigned int *) addr.off
: 0; }
327 * The expr rule builds an expression tree. When we are done, we call
328 * EvalExpr to evaluate the value of the expression. The advantage of
329 * the two-step approach is that it is possible to save expressions for
330 * use in 'display' commands, and in conditional watchpoints.
333 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
334 | tSTRING
{ $$
= DEBUG_StringExpr
($1); }
335 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
336 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
337 | expr OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
338 | expr
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
339 | tIDENTIFIER
'(' ')' { $$
= DEBUG_CallExpr
($1, 0); }
340 | tIDENTIFIER
'(' expr
')' { $$
= DEBUG_CallExpr
($1, 1, $3); }
341 | tIDENTIFIER
'(' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 2, $3,
343 | tIDENTIFIER
'(' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7); }
344 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9); }
345 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9, $11); }
346 | expr
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
347 | expr
':' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SEG
, $1, $3); }
348 | expr OP_LOR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LOR
, $1, $3); }
349 | expr OP_LAND expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LAND
, $1, $3); }
350 | expr
'|' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_OR
, $1, $3); }
351 | expr
'&' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_AND
, $1, $3); }
352 | expr
'^' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_XOR
, $1, $3); }
353 | expr OP_EQ expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_EQ
, $1, $3); }
354 | expr
'>' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GT
, $1, $3); }
355 | expr
'<' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LT
, $1, $3); }
356 | expr OP_GE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GE
, $1, $3); }
357 | expr OP_LE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LE
, $1, $3); }
358 | expr OP_NE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_NE
, $1, $3); }
359 | expr OP_SHL expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHL
, $1, $3); }
360 | expr OP_SHR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHR
, $1, $3); }
361 | expr
'+' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_ADD
, $1, $3); }
362 | expr
'-' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SUB
, $1, $3); }
363 | expr
'*' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_MUL
, $1, $3); }
364 | expr
'/' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_DIV
, $1, $3); }
365 | expr
'%' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_REM
, $1, $3); }
366 |
'-' expr %prec OP_SIGN
{ $$
= DEBUG_UnopExpr
(EXP_OP_NEG
, $2); }
367 |
'+' expr %prec OP_SIGN
{ $$
= $2; }
368 |
'!' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_NOT
, $2); }
369 |
'~' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_LNOT
, $2); }
370 |
'(' expr
')' { $$
= $2; }
371 |
'*' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_DEREF
, $2); }
372 |
'&' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_ADDR
, $2); }
373 | type_cast expr %prec OP_DEREF
{ $$
= DEBUG_TypeCastExpr
($1, $2); }
376 * The lvalue rule builds an expression tree. This is a limited form
377 * of expression that is suitable to be used as an lvalue.
380 lval
{ $$
= DEBUG_EvalExpr
($1); }
384 |
'*' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_FORCE_DEREF
, $2); }
387 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
388 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
389 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
390 | lvalue OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
391 | lvalue
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
392 | lvalue
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
398 #ifdef DONT_USE_READLINE
399 fprintf
(stderr
,"Wine-dbg>");
403 void mode_command
(int newmode
)
405 if
((newmode
== 16) ||
(newmode
== 32)) dbg_mode
= newmode
;
406 else fprintf
(stderr
,"Invalid mode (use 16 or 32)\n");
410 /***********************************************************************
413 * Debugger main loop.
415 static void DEBUG_Main
( int signal
)
417 static int loaded_symbols
= 0;
418 static BOOL32 in_debugger
= FALSE
;
419 char SymbolTableFile
[256];
428 fprintf
( stderr
, "Segmentation fault inside debugger, exiting.\n" );
434 DEBUG_SetBreakpoints
( FALSE
);
441 * Initialize the type handling stuff.
446 * In some cases we can read the stabs information directly
447 * from the executable. If this is the case, we don't need
448 * to bother with trying to read a symbol file, as the stabs
449 * also have line number and local variable information.
450 * As long as gcc is used for the compiler, stabs will
451 * be the default. On SVr4, DWARF could be used, but we
452 * don't grok that yet, and in this case we fall back to using
455 if
( DEBUG_ReadExecutableDbgInfo
() == FALSE
)
457 char *symfilename
= "wine.sym";
459 if
(-1 == stat
(symfilename
, &statbuf
) )
460 symfilename
= LIBDIR
"wine.sym";
462 PROFILE_GetWineIniString
( "wine", "SymbolTableFile", symfilename
,
463 SymbolTableFile
, sizeof
(SymbolTableFile
));
464 DEBUG_ReadSymbolTable
( SymbolTableFile
);
467 DEBUG_LoadEntryPoints
();
468 DEBUG_ProcessDeferredDebug
();
472 fprintf
(stderr
, "Entering debugger PC=%x, mode=%d, count=%d\n",
473 EIP_reg
(&DEBUG_context
),
474 dbg_exec_mode
, dbg_exec_count
);
479 if
((signal
!= SIGTRAP
) ||
!DEBUG_ShouldContinue
( dbg_exec_mode
,
483 TDB
*pTask
= (TDB
*)GlobalLock16
( GetCurrentTask
() );
485 addr.seg
= CS_reg
(&DEBUG_context
);
486 addr.off
= EIP_reg
(&DEBUG_context
);
487 if
(ISV86
(&DEBUG_context
)) addr.seg |
= (DWORD
)(pTask?
(pTask
->hModule
):0)<<16;
489 DBG_FIX_ADDR_SEG
( &addr
, 0 );
491 GlobalUnlock16
( GetCurrentTask
() );
493 /* Put the display in a correct state */
495 TSXUngrabServer
( display
);
498 newmode
= ISV86
(&DEBUG_context
) ?
16 : IS_SELECTOR_32BIT
(addr.seg
) ?
32 : 16;
499 if
(newmode
!= dbg_mode
)
500 fprintf
(stderr
,"In %d bit mode.\n", dbg_mode
= newmode
);
502 PROCESS_SuspendOtherThreads
();
506 if
(signal
!= SIGTRAP
) /* This is a real crash, dump some info */
508 DEBUG_InfoRegisters
();
512 LDT_Print
( SELECTOR_TO_ENTRY
(DS_reg
(&DEBUG_context
)), 1 );
513 if
(ES_reg
(&DEBUG_context
) != DS_reg
(&DEBUG_context
))
514 LDT_Print
( SELECTOR_TO_ENTRY
(ES_reg
(&DEBUG_context
)), 1 );
521 * Do a quiet backtrace so that we have an idea of what the situation
522 * is WRT the source files.
524 DEBUG_SilentBackTrace
();
527 if
((signal
!= SIGTRAP
) ||
528 (dbg_exec_mode
== EXEC_STEPI_OVER
) ||
529 (dbg_exec_mode
== EXEC_STEPI_INSTR
))
531 /* Show where we crashed */
533 DEBUG_PrintAddress
( &addr
, dbg_mode
, TRUE
);
534 fprintf
(stderr
,": ");
535 if
(DBG_CHECK_READ_PTR
( &addr
, 1 ))
537 DEBUG_Disasm
( &addr
, TRUE
);
538 fprintf
(stderr
,"\n");
548 addr.seg
= CS_reg
(&DEBUG_context
) |
(addr.seg
&0xffff0000);
549 addr.off
= EIP_reg
(&DEBUG_context
);
550 DBG_FIX_ADDR_SEG
( &addr
, 0 );
551 ret_ok
= DEBUG_ValidateRegisters
();
552 if
(ret_ok
) ret_ok
= DBG_CHECK_READ_PTR
( &addr
, 1 );
556 dbg_exec_mode
= DEBUG_RestartExecution
( dbg_exec_mode
, dbg_exec_count
);
558 * This will have gotten absorbed into the breakpoint info
559 * if it was used. Otherwise it would have been ignored.
560 * In any case, we don't mess with it any more.
562 if
( dbg_exec_mode
== EXEC_CONT
)
565 PROCESS_ResumeOtherThreads
();
573 /***********************************************************************
574 * DebugBreak (KERNEL.203) (KERNEL32.181)
576 void DebugBreak
( CONTEXT
*regs
)
579 if
(!GetModuleName
( GetCurrentTask
(), module
, sizeof
(module
) ))
580 strcpy
( module
, "???" );
581 fprintf
( stderr
, "%s called DebugBreak\n", module
);
582 DEBUG_context
= *regs
;
583 DEBUG_Main
( SIGTRAP
);
587 void ctx_debug
( int signal
, CONTEXT
*regs
)
589 DEBUG_context
= *regs
;
590 DEBUG_Main
( signal
);
591 *regs
= DEBUG_context
;
594 void wine_debug
( int signal
, SIGCONTEXT
*regs
)
597 DWORD
*stack
= (DWORD
*)ESP_sig
(regs
);
600 *(--stack
) = EH_NONCONTINUABLE
;
601 *(--stack
) = EXCEPTION_ACCESS_VIOLATION
;
602 *(--stack
) = EIP_sig
(regs
);
603 ESP_sig
(regs
) = (DWORD
)stack
;
604 EIP_sig
(regs
) = (DWORD
)RaiseException
;
606 DEBUG_SetSigContext
( regs
);
607 DEBUG_Main
( signal
);
608 DEBUG_GetSigContext
( regs
);
612 int yyerror(char * s
)
614 fprintf
(stderr
,"%s\n", s
);