3 * Parser for command lines in the Wine debugger
5 * Copyright 1993 Eric Youngdale
6 * Copyright 1995 Morten Welinder
19 #include "wine/exception.h"
24 void issue_prompt
(void);
25 void mode_command
(int);
26 void flush_symbols
(void);
38 struct list_id listing
;
39 struct expr
* expression
;
40 struct datatype
* type
;
43 %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
44 %token tENABLE tDISABLE tBREAK tWATCH tDELETE tSET tMODE tPRINT tEXAM tABORT
45 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
46 %token tPROCESS tMODREF
47 %token tEOL tSTRING tDEBUGSTR
48 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
49 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
51 %token
<string> tIDENTIFIER tSTRING tDEBUGSTR
52 %token
<integer
> tNUM tFORMAT
56 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
57 %token tSTRUCT tUNION tENUM
60 /* %left '=' OP_OR_EQUAL OP_XOR_EQUAL OP_AND_EQUAL OP_SHL_EQUAL \
61 OP_SHR_EQUAL OP_PLUS_EQUAL OP_MINUS_EQUAL \
62 OP_TIMES_EQUAL OP_DIVIDE_EQUAL OP_MODULO_EQUAL */
63 /* %left OP_COND */ /* ... ? ... : ... */
70 %left
'<' '>' OP_LE OP_GE
74 %left OP_SIGN
'!' '~' OP_DEREF
/* OP_INC OP_DEC OP_ADDR */
78 %type
<expression
> expr lval lvalue
79 %type
<type
> type_cast type_expr
80 %type
<address
> expr_addr lval_addr
81 %type
<integer
> expr_value
82 %type
<string> pathname
84 %type
<listing
> list_arg
88 input: line
{ issue_prompt
(); }
89 | input line
{ issue_prompt
(); }
93 |
error tEOL
{ yyerrok; }
96 tQUIT tEOL
{ DEBUG_Exit
(0); }
97 | tHELP tEOL
{ DEBUG_Help
(); }
98 | tHELP tINFO tEOL
{ DEBUG_HelpInfo
(); }
99 | tCONT tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
100 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_CONT
; return
0; }
101 | tPASS tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
102 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_PASS
; return
0; }
103 | tCONT tNUM tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= $2;
104 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_CONT
; return
0; }
105 | tSTEP tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
106 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
107 | tNEXT tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
108 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
109 | tSTEP tNUM tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= $2;
110 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEP_INSTR
; return
0; }
111 | tNEXT tNUM tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= $2;
112 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEP_OVER
; return
0; }
113 | tSTEPI tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
114 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
115 | tNEXTI tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 1;
116 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
117 | tSTEPI tNUM tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= $2;
118 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEPI_INSTR
; return
0; }
119 | tNEXTI tNUM tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= $2;
120 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_STEPI_OVER
; return
0; }
121 | tABORT tEOL
{ kill
(getpid
(), SIGABRT
); }
122 | tMODE tNUM tEOL
{ mode_command
($2); }
123 | tENABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, TRUE
); }
124 | tDISABLE tNUM tEOL
{ DEBUG_EnableBreakpoint
( $2, FALSE
); }
125 | tDELETE tBREAK tNUM tEOL
{ DEBUG_DelBreakpoint
( $3 ); }
126 | tBACKTRACE tEOL
{ DEBUG_BackTrace
(TRUE
); }
127 | tUP tEOL
{ DEBUG_SetFrame
( curr_frame
+ 1 ); }
128 | tUP tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
+ $2 ); }
129 | tDOWN tEOL
{ DEBUG_SetFrame
( curr_frame
- 1 ); }
130 | tDOWN tNUM tEOL
{ DEBUG_SetFrame
( curr_frame
- $2 ); }
131 | tFRAME tNUM tEOL
{ DEBUG_SetFrame
( $2 ); }
132 | tFINISH tEOL
{ DEBUG_CurrThread
->dbg_exec_count
= 0;
133 DEBUG_CurrThread
->dbg_exec_mode
= EXEC_FINISH
; return
0; }
134 | tSHOW tDIR tEOL
{ DEBUG_ShowDir
(); }
135 | tDIR pathname tEOL
{ DEBUG_AddPath
( $2 ); }
136 | tDIR tEOL
{ DEBUG_NukePath
(); }
137 | tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
138 | tDISPLAY expr tEOL
{ DEBUG_AddDisplay
($2, 1, 0); }
139 | tDISPLAY tFORMAT expr tEOL
{ DEBUG_AddDisplay
($3, $2 >> 8, $2 & 0xff); }
140 | tDELETE tDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $3 ); }
141 | tDELETE tDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
142 | tUNDISPLAY tNUM tEOL
{ DEBUG_DelDisplay
( $2 ); }
143 | tUNDISPLAY tEOL
{ DEBUG_DelDisplay
( -1 ); }
144 | tCOND tNUM tEOL
{ DEBUG_AddBPCondition
($2, NULL
); }
145 | tCOND tNUM expr tEOL
{ DEBUG_AddBPCondition
($2, $3); }
146 | tSYMBOLFILE pathname tEOL
{ DEBUG_ReadSymbolTable
($2); }
148 | disassemble_command
157 tSET tREG
'=' expr_value tEOL
{ DEBUG_SetRegister
( $2, $4 );
158 DEBUG_FreeExprMem
(); }
159 | tSET lval_addr
'=' expr_value tEOL
{ DEBUG_WriteMemory
( &$2, $4 );
160 DEBUG_FreeExprMem
(); }
163 tIDENTIFIER
{ $$
= $1; }
167 tDISASSEMBLE tEOL
{ DEBUG_Disassemble
( NULL
, NULL
, 10 ); }
168 | tDISASSEMBLE expr_addr tEOL
{ DEBUG_Disassemble
( & $2, NULL
, 10 ); }
169 | tDISASSEMBLE expr_addr
',' expr_addr tEOL
{ DEBUG_Disassemble
( & $2, & $4, 0 ); }
172 tLIST tEOL
{ DEBUG_List
( NULL
, NULL
, 10 ); }
173 | tLIST
'-' tEOL
{ DEBUG_List
( NULL
, NULL
, -10 ); }
174 | tLIST list_arg tEOL
{ DEBUG_List
( & $2, NULL
, 10 ); }
175 | tLIST
',' list_arg tEOL
{ DEBUG_List
( NULL
, & $3, -10 ); }
176 | tLIST list_arg
',' list_arg tEOL
{ DEBUG_List
( & $2, & $4, 0 ); }
179 tNUM
{ $$.sourcefile
= NULL
; $$.line
= $1; }
180 | pathname
':' tNUM
{ $$.sourcefile
= $1; $$.line
= $3; }
181 | tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, NULL
, $1); }
182 | pathname
':' tIDENTIFIER
{ DEBUG_GetFuncInfo
( & $$
, $1, $3); }
183 |
'*' expr_addr
{ DEBUG_FindNearestSymbol
( & $2, FALSE
, NULL
,
185 DEBUG_FreeExprMem
(); }
188 tEXAM expr_addr tEOL
{ DEBUG_ExamineMemory
( &$2, 1, 'x');
189 DEBUG_FreeExprMem
(); }
190 | tEXAM tFORMAT expr_addr tEOL
{ DEBUG_ExamineMemory
( &$3, $2>>8, $2&0xff );
191 DEBUG_FreeExprMem
(); }
194 tPRINT expr_addr tEOL
{ DEBUG_Print
( &$2, 1, 0, 0 );
195 DEBUG_FreeExprMem
(); }
196 | tPRINT tFORMAT expr_addr tEOL
{ DEBUG_Print
( &$3, $2 >> 8, $2 & 0xff, 0 );
197 DEBUG_FreeExprMem
(); }
200 tBREAK
'*' expr_addr tEOL
{ DEBUG_AddBreakpoint
( &$3 );
201 DEBUG_FreeExprMem
(); }
202 | tBREAK tIDENTIFIER tEOL
{ DBG_ADDR addr
;
203 if
( DEBUG_GetSymbolValue
($2, -1, &addr
, TRUE
) )
205 DEBUG_AddBreakpoint
( &addr
);
209 fprintf
(stderr
,"Unable to add breakpoint\n");
212 | tBREAK tIDENTIFIER
':' tNUM tEOL
{ DBG_ADDR addr
;
213 if
( DEBUG_GetSymbolValue
($2, $4, &addr
, TRUE
) )
215 DEBUG_AddBreakpoint
( &addr
);
219 fprintf
(stderr
,"Unable to add breakpoint\n");
222 | tBREAK tNUM tEOL
{ struct name_hash
*nh
;
224 DEBUG_GetCurrentAddress
( &addr
);
225 DEBUG_FindNearestSymbol
(&addr
, TRUE
,
229 DEBUG_GetLineNumberAddr
(nh
,
231 DEBUG_AddBreakpoint
( &addr
);
235 fprintf
(stderr
,"Unable to add breakpoint\n");
239 | tBREAK tEOL
{ DBG_ADDR addr
;
240 DEBUG_GetCurrentAddress
( &addr
);
241 DEBUG_AddBreakpoint
( &addr
);
245 tINFO tBREAK tEOL
{ DEBUG_InfoBreakpoints
(); }
246 | tINFO tCLASS tSTRING tEOL
{ DEBUG_InfoClass
( $3 ); DEBUG_FreeExprMem
(); }
247 | tINFO tSHARE tEOL
{ DEBUG_InfoShare
(); }
248 | tINFO tMODULE expr_value tEOL
{ DEBUG_DumpModule
( $3 );
249 DEBUG_FreeExprMem
(); }
250 | tINFO tQUEUE expr_value tEOL
{ DEBUG_DumpQueue
( $3 );
251 DEBUG_FreeExprMem
(); }
252 | tINFO tREGS tEOL
{ DEBUG_InfoRegisters
(); }
253 | tINFO tSEGMENTS expr_value tEOL
{ DEBUG_InfoSegments
( $3, 1 ); DEBUG_FreeExprMem
(); }
254 | tINFO tSEGMENTS tEOL
{ DEBUG_InfoSegments
( 0, -1 ); }
255 | tINFO tSTACK tEOL
{ DEBUG_InfoStack
(); }
256 | tINFO tMAPS tEOL
{ DEBUG_InfoVirtual
(); }
257 | tINFO tWND expr_value tEOL
{ DEBUG_InfoWindow
( (HWND
)$3 );
258 DEBUG_FreeExprMem
(); }
259 | tINFO tLOCAL tEOL
{ DEBUG_InfoLocals
(); }
260 | tINFO tDISPLAY tEOL
{ DEBUG_InfoDisplay
(); }
263 tWALK tCLASS tEOL
{ DEBUG_WalkClasses
(); }
264 | tWALK tMODULE tEOL
{ DEBUG_WalkModules
(); }
265 | tWALK tQUEUE tEOL
{ DEBUG_WalkQueues
(); }
266 | tWALK tWND tEOL
{ DEBUG_WalkWindows
( 0, 0 ); }
267 | tWALK tWND tNUM tEOL
{ DEBUG_WalkWindows
( $3, 0 ); }
268 | tWALK tPROCESS tEOL
{ DEBUG_WalkProcess
(); }
269 | tWALK tMODREF expr_value tEOL
{ DEBUG_WalkModref
( $3 ); }
273 '(' type_expr
')' { $$
= $2; }
276 type_expr
'*' { $$
= DEBUG_FindOrMakePointerType
($1); }
277 | tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "int"); }
278 | tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "char"); }
279 | tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long int"); }
280 | tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned int"); }
281 | tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long unsigned int"); }
282 | tLONG tLONG tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long int"); }
283 | tLONG tLONG tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long long unsigned int"); }
284 | tSHORT tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short int"); }
285 | tSHORT tUNSIGNED tINT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "short unsigned int"); }
286 | tSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "signed char"); }
287 | tUNSIGNED tCHAR
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "unsigned char"); }
288 | tFLOAT
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "float"); }
289 | tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "double"); }
290 | tLONG tDOUBLE
{ $$
= DEBUG_TypeCast
(DT_BASIC
, "long double"); }
291 | tSTRUCT tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
292 | tUNION tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_STRUCT
, $2); }
293 | tENUM tIDENTIFIER
{ $$
= DEBUG_TypeCast
(DT_ENUM
, $2); }
296 expr
{ $$
= DEBUG_EvalExpr
($1); }
299 expr
{ DBG_ADDR addr
= DEBUG_EvalExpr
($1);
300 /* expr_value is typed as an integer */
301 if
(!addr.off ||
!DEBUG_READ_MEM
((void*)addr.off
, &$$
, sizeof
($$
)))
304 * The expr rule builds an expression tree. When we are done, we call
305 * EvalExpr to evaluate the value of the expression. The advantage of
306 * the two-step approach is that it is possible to save expressions for
307 * use in 'display' commands, and in conditional watchpoints.
310 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
311 | tSTRING
{ $$
= DEBUG_StringExpr
($1); }
312 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
313 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
314 | expr OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
315 | expr
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
316 | tIDENTIFIER
'(' ')' { $$
= DEBUG_CallExpr
($1, 0); }
317 | tIDENTIFIER
'(' expr
')' { $$
= DEBUG_CallExpr
($1, 1, $3); }
318 | tIDENTIFIER
'(' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 2, $3,
320 | tIDENTIFIER
'(' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7); }
321 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9); }
322 | tIDENTIFIER
'(' expr
',' expr
',' expr
',' expr
',' expr
')' { $$
= DEBUG_CallExpr
($1, 3, $3, $5, $7, $9, $11); }
323 | expr
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
324 | expr
':' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SEG
, $1, $3); }
325 | expr OP_LOR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LOR
, $1, $3); }
326 | expr OP_LAND expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LAND
, $1, $3); }
327 | expr
'|' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_OR
, $1, $3); }
328 | expr
'&' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_AND
, $1, $3); }
329 | expr
'^' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_XOR
, $1, $3); }
330 | expr OP_EQ expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_EQ
, $1, $3); }
331 | expr
'>' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GT
, $1, $3); }
332 | expr
'<' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LT
, $1, $3); }
333 | expr OP_GE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_GE
, $1, $3); }
334 | expr OP_LE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_LE
, $1, $3); }
335 | expr OP_NE expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_NE
, $1, $3); }
336 | expr OP_SHL expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHL
, $1, $3); }
337 | expr OP_SHR expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SHR
, $1, $3); }
338 | expr
'+' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_ADD
, $1, $3); }
339 | expr
'-' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_SUB
, $1, $3); }
340 | expr
'*' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_MUL
, $1, $3); }
341 | expr
'/' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_DIV
, $1, $3); }
342 | expr
'%' expr
{ $$
= DEBUG_BinopExpr
(EXP_OP_REM
, $1, $3); }
343 |
'-' expr %prec OP_SIGN
{ $$
= DEBUG_UnopExpr
(EXP_OP_NEG
, $2); }
344 |
'+' expr %prec OP_SIGN
{ $$
= $2; }
345 |
'!' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_NOT
, $2); }
346 |
'~' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_LNOT
, $2); }
347 |
'(' expr
')' { $$
= $2; }
348 |
'*' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_DEREF
, $2); }
349 |
'&' expr %prec OP_DEREF
{ $$
= DEBUG_UnopExpr
(EXP_OP_ADDR
, $2); }
350 | type_cast expr %prec OP_DEREF
{ $$
= DEBUG_TypeCastExpr
($1, $2); }
353 * The lvalue rule builds an expression tree. This is a limited form
354 * of expression that is suitable to be used as an lvalue.
357 lval
{ $$
= DEBUG_EvalExpr
($1); }
361 |
'*' expr
{ $$
= DEBUG_UnopExpr
(EXP_OP_FORCE_DEREF
, $2); }
364 tNUM
{ $$
= DEBUG_ConstExpr
($1); }
365 | tREG
{ $$
= DEBUG_RegisterExpr
($1); }
366 | tIDENTIFIER
{ $$
= DEBUG_SymbolExpr
($1); }
367 | lvalue OP_DRF tIDENTIFIER
{ $$
= DEBUG_StructPExpr
($1, $3); }
368 | lvalue
'.' tIDENTIFIER
{ $$
= DEBUG_StructExpr
($1, $3); }
369 | lvalue
'[' expr
']' { $$
= DEBUG_BinopExpr
(EXP_OP_ARR
, $1, $3); }
375 #ifdef DONT_USE_READLINE
376 fprintf
(stderr
,"Wine-dbg>");
380 void mode_command
(int newmode
)
382 if
((newmode
== 16) ||
(newmode
== 32)) DEBUG_CurrThread
->dbg_mode
= newmode
;
383 else fprintf
(stderr
,"Invalid mode (use 16 or 32)\n");
386 static WINE_EXCEPTION_FILTER
(no_symbol
)
388 if
(GetExceptionCode
() == DEBUG_STATUS_NO_SYMBOL
)
389 return EXCEPTION_EXECUTE_HANDLER
;
390 return EXCEPTION_CONTINUE_SEARCH
;
393 /***********************************************************************
396 * Kill current process.
399 void DEBUG_Exit
( DWORD exit_code
)
401 TASK_KillTask
( 0 ); /* FIXME: should not be necessary */
402 TerminateProcess
( DEBUG_CurrProcess
->handle
, exit_code
);
405 /***********************************************************************
408 * Debugger main loop.
410 BOOL DEBUG_Main
( BOOL is_debug
, BOOL force
, DWORD code
)
422 DEBUG_SuspendExecution
();
427 if
(DEBUG_IsSelectorSystem
(DEBUG_context.SegCs
))
428 fprintf
( stderr
, " in 32-bit code (0x%08lx).\n", DEBUG_context.Eip
);
430 fprintf
( stderr
, " in 16-bit code (%04x:%04lx).\n",
431 (WORD
)DEBUG_context.SegCs
, DEBUG_context.Eip
);
433 fprintf
( stderr
, " (%p).\n", GET_IP
(&DEBUG_context
) );
437 if
(DEBUG_LoadEntryPoints
("Loading new modules symbols:\n"))
438 DEBUG_ProcessDeferredDebug
();
440 if
(force ||
!(is_debug
&& DEBUG_ShouldContinue
( code
,
441 DEBUG_CurrThread
->dbg_exec_mode
,
442 &DEBUG_CurrThread
->dbg_exec_count
)))
445 DEBUG_GetCurrentAddress
( &addr
);
447 /* EPP if (USER_Driver) USER_Driver->pBeginDebugging(); */
450 switch
(newmode
= DEBUG_GetSelectorType
(addr.seg
)) {
451 case
16: case
32: break
;
452 default
: fprintf
(stderr
, "Bad CS (%ld)\n", addr.seg
); newmode
= 32;
457 if
(newmode
!= DEBUG_CurrThread
->dbg_mode
)
458 fprintf
(stderr
,"In %d bit mode.\n", DEBUG_CurrThread
->dbg_mode
= newmode
);
462 if
(is_debug || force
)
465 * Do a quiet backtrace so that we have an idea of what the situation
466 * is WRT the source files.
468 DEBUG_BackTrace
(FALSE
);
472 /* This is a real crash, dump some info */
473 DEBUG_InfoRegisters
();
476 if
(DEBUG_CurrThread
->dbg_mode
== 16)
478 DEBUG_InfoSegments
( DEBUG_context.SegDs
>> 3, 1 );
479 if
(DEBUG_context.SegEs
!= DEBUG_context.SegDs
)
480 DEBUG_InfoSegments
( DEBUG_context.SegEs
>> 3, 1 );
482 DEBUG_InfoSegments
( DEBUG_context.SegFs
>> 3, 1 );
484 DEBUG_BackTrace
(TRUE
);
488 (DEBUG_CurrThread
->dbg_exec_mode
== EXEC_STEPI_OVER
) ||
489 (DEBUG_CurrThread
->dbg_exec_mode
== EXEC_STEPI_INSTR
))
491 /* Show where we crashed */
493 DEBUG_PrintAddress
( &addr
, DEBUG_CurrThread
->dbg_mode
, TRUE
);
494 fprintf
(stderr
,": ");
495 DEBUG_Disasm
( &addr
, TRUE
);
496 fprintf
( stderr
, "\n" );
508 DEBUG_GetCurrentAddress
( &addr
);
509 if
((ret_ok
= DEBUG_ValidateRegisters
()))
510 ret_ok
= DEBUG_READ_MEM_VERBOSE
((void*)DEBUG_ToLinear
( &addr
), &ch
, 1 );
514 fprintf
(stderr
, "Undefined symbol\n");
522 DEBUG_CurrThread
->dbg_exec_mode
= DEBUG_RestartExecution
( DEBUG_CurrThread
->dbg_exec_mode
, DEBUG_CurrThread
->dbg_exec_count
);
524 * This will have gotten absorbed into the breakpoint info
525 * if it was used. Otherwise it would have been ignored.
526 * In any case, we don't mess with it any more.
528 if
((DEBUG_CurrThread
->dbg_exec_mode
== EXEC_CONT
) ||
(DEBUG_CurrThread
->dbg_exec_mode
== EXEC_PASS
))
529 DEBUG_CurrThread
->dbg_exec_count
= 0;
530 /* EPP if (USER_Driver) USER_Driver->pEndDebugging(); */
532 return
(DEBUG_CurrThread
->dbg_exec_mode
== EXEC_PASS
) ?
0 : DBG_CONTINUE
;
537 fprintf
(stderr
,"%s\n", s
);