4 /* Parser for command lines in the Wine debugger
18 unsigned int * regval
= NULL
;
19 unsigned int dbg_mask
= 0;
20 unsigned int dbg_mode
= 0;
22 void issue_prompt
(void);
23 void mode_command
(int);
51 | input line
{ issue_prompt
(); }
55 |
error '\n' { yyerrok; }
56 | QUIT
'\n' { exit
(0); }
57 |
'q' '\n' { exit
(0); }
58 | HELP
'\n' { dbg_help
(); }
59 | CONT
'\n' { return
; }
60 |
'c' '\n' { return
; }
61 | ABORT
'\n' { kill
(getpid
(), SIGABRT
); }
62 | SYMBOLFILE IDENTIFIER
'\n' { read_symboltable
($2); }
63 | DEFINE IDENTIFIER expr
'\n' { add_hash
($2, $3); }
64 | MODE NUM
{ mode_command
($2); }
65 | ENABLE NUM
{ enable_break
($2); }
66 | DISABLE NUM
{ disable_break
($2); }
67 | BREAK
'*' expr
{ add_break
($3); }
69 | BACKTRACE
'\n' { dbg_bt
(); }
74 SET REG
'=' expr
'\n' { if
(regval
) regval
[$2] = $4; else application_not_running
();}
75 | SET
'*' expr
'=' expr
'\n' { *((unsigned int *) $3) = $5; }
76 | SET symbol
'=' expr
'\n' { *((unsigned int *) $2) = $4; }
80 'x' expr
'\n' { examine_memory
($2, 1, 'x'); }
81 |
'x' '/' fmt expr
'\n' { examine_memory
($4, 1, $3); }
82 |
'x' '/' NUM fmt expr
'\n' { examine_memory
($5, $3, $4); }
89 print expr
'\n' { examine_memory
(((unsigned int) &$2 ), 1, 'x'); }
90 | print
'/' fmt expr
'\n' { examine_memory
((unsigned int) &$4, 1, $3); }
91 | print
'/' NUM fmt expr
'\n' { examine_memory
((unsigned int) &$5, $3, $4); }
93 fmt
: 'x' { $$
= 'x'; }
101 symbol
: IDENTIFIER
{ $$
= find_hash
($1);
102 if
($$
== 0xffffffff) {
103 fprintf
(stderr
,"Symbol %s not found\n", $1);
108 expr
: NUM
{ $$
= $1; }
109 | REG
{ if
(regval
) $$
= regval
[$1]; else application_not_running
();}
110 | symbol
{ $$
= *((unsigned int *) $1); }
111 | expr
'+' NUM
{ $$
= $1 + $3; }
112 | expr
'-' NUM
{ $$
= $1 - $3; }
113 |
'(' expr
')' { $$
= $2; }
114 |
'*' expr
{ $$
= *((unsigned int *) $2); }
116 infocmd
: INFO REGS
{ info_reg
(); }
117 | INFO STACK
{ info_stack
(); }
118 | INFO BREAK
{ info_break
(); }
126 fprintf
(stderr
,"Wine-dbg>");
130 void mode_command
(int newmode
)
138 dbg_mask
= 0xffffffff;
142 fprintf
(stderr
,"Invalid mode (use 16 or 32)\n");
145 static int loaded_symbols
= 0;
148 wine_debug
(int signal
, int * regs
)
150 static int dummy_regs
[32];
157 regval
= regs ? regs
: dummy_regs
;
160 if
((SC_CS
& 7) != 7) {
161 dbg_mask
= 0xffffffff;
170 dbg_mask
= 0xffffffff;
177 fprintf
(stderr
,"In %d bit mode.\n", dbg_mode
);
179 /* This is intended to read the entry points from the Windows image, and
180 insert them in the hash table. It does not work yet, so it is commented out. */
183 read_symboltable
("wine.sym");
189 /* Remove the breakpoints from memory... */
190 fprintf
(stderr
,"Removing BPs\n");
193 /* If we stopped on a breakpoint, report this fact */
194 if
(signal
== SIGTRAP
)
197 addr
= SC_EIP
(dbg_mask
);
198 if
((addr
& 0xffff0000) == 0 && dbg_mode
== 16)
200 fprintf
(stderr
,"Stopped on breakpoint %d\n", get_bpnum
(addr
));
203 /* Show where we crashed */
205 examine_memory
(SC_EIP
(dbg_mask
), 1, 'i');
212 /* Re-insert the breakpoints from memory... */
215 fprintf
(stderr
,"Returning to Wine...\n");
221 fprintf
(stderr
,"%s\n", s
);