Fix primary buffer memory leak.
[wine/multimedia.git] / programs / winedbg / winedbg.man
blob7846e0a3764ad740cf0c740f2143e7d6fe3e1658
1 .TH WINEDBG 1 "May 2004" "Wine Manpage" "Wine Developers Manual"
2 .SH NAME
3 winedbg \- Wine's debugger
4 .SH SYNOPSIS
5 .BR "winedbg " [ " --auto" " |"
6 .BI "--gdb"
7 .RI "[" " options " "] ] ["
8 .BI "program name"
9 .RI "["
10 .BI "program arguments"
11 .RI "] |"
12 .BI "pid"
13 .RI "]"
14 .SH DESCRIPTION
15 .B winedbg
16 is a debugger for Wine. It allows:
17 .RS 4
18 + debugging native Win32 applications
19 .nf
20 + debugging Winelib applications.
21 .nf
22 + being a drop-in replacement for Dr Watson
23 .RE
24 .PP
26 .SH MODES
27 \fBwinedbg\fR can be used in three modes.  The first argument to the
28 program determines the mode winedbg will run in.
29 .IP \fBdefault\fR
30 Without any explicit mode, this is standard \fBwinedbg\fR operating
31 mode. \fBwinedbg\fR will act as the front end for the user.
32 .IP \fB--auto\fR
33 This mode is used when \fBwinedbg\fR is setup in \fIAeDebug\fR
34 registry entry as the default debugger. \fBwinedbg\fR will then
35 display basic information about a crash. This is usefull for users
36 who don't want to debug a crash, but rather gather relevant
37 information about the crash to be sent to developers.
38 .IP \fB--gdb\fR
39 \fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
40 the front end for command handling, and \fBwinedbg\fR will proxy all
41 debugging requests from \fBgdb\fR to the Win32 APIs.
43 .SH OPTIONS
44 Only the \fBgdb\fR proxy mode allows some options:
45 .PP
46 .IP \fI--no-start\fR \fBgdb\fR will not be automatically
47 started. Relevant information for starting \fBgdb\fR are printed on
48 screen. This is somehow usefull when not directly using \fBgdb\fR but
49 some graphical front-ends, like \fBddd\fR or \fBkgbd\fR. 
50 .IP \fI--with-xterm\fR
51 This will run \fBgdb\fR in its own xterm instead of using the current
52 Unix console for textual display.
53 .PP
54 The rest of the command line, when passed, is used to identify which
55 programs, if any, has to debugged:
56 .IP \fBprogram\ name\fR
57 This is the name of an executable to start for a debugging
58 session.  \fBwinedbg\fR will actually create a process with this
59 executable. If \fBprograms arguments\fR are also given, they will be
60 used as arguments for creating the process to be debugged.
61 .IP \fBpid\fR
62 \fBgdb\fR will attach to the process which pid is \fBpid\fR (pids
63 refer to Win32 pids, not Unix pids). Use the \fIinfo proc\fR
64 \fBwinedbg\fR command to list running processes and their Win32 pids.
65 .IP \fBdefaut\fR
66 If nothing is specified, you will enter the debugger without any run
67 nor attached process. You'll have to do the job yourself.
69 .SH COMMANDS
70 .SS Default mode:
71 .PP
72 Most of commands used in \fBwinedbg\fR are similar to the ones from
73 \fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
74 details. See the \fIgdb\ differences\fR section later on to get a list
75 of variations from \fBgdb\fR commands.
76 .PP
77 \fIMisc. commands\fR
78 .IP \fBabort\fR
79 Aborts the debugger.
80 .IP \fBquit\fR
81 Exits the debugger.
82 .IP \fBattach\ N\fR
83 Attach to a Wine-process (\fBN\fR is its ID, numeric or hexadecimal).
84 IDs can be obtained using the \fBinfo\ process\fR command.  Note the
85 \fBinfo\ process\fR command returns hexadecimal values
86 .IP 
87 .IP \fBdetach\fR
88 Detach from a Wine-process.
89 .PP
90 \fIHelp commands\fR
91 .IP \fBhelp\fR
92 Prints some help on the commands.
93 .IP \fBhelp\ info\fR
94 Prints some help on info commands
95 .PP
96 \fIFlow control commands\fR
97 .IP \fBcont\fR
98 Continue execution until next breakpoint or exception.
99 .IP \fBpass\fR
100 Pass the exception event up to the filter chain.
101 .IP \fBstep\fR
102 Continue execution until next C line of code (enters function call)
103 .IP \fBnext\fR
104 Continue execution until next C line of code (doesn't enter function
105 call)
106 .IP \fBstepi\fR
107 Execute next assembly instruction (enters function call)
108 .IP \fBnexti\fR
109 Execute next assembly instruction (doesn't enter function call)
110 .IP \fBfinish\fR
111 Excute until return of current function is reached.
113 \fBcont\fR, \fBstep\fR, \fBnext\fR, \fBstepi\fR, \fBnexti\fR can be
114 postfixed by a number (N), meaning that the command must be executed N
115 times before control is returned to the user.
117 \fIBreakpoints, watchpoints
118 .IP \fBenable\ N\fR
119 Enables (break|watch)-point #\fBN\fR
120 .IP \fBdisable\fR
121 Disables (break|watch)-point \fB#N\fR
122 .IP \fBdelete\fR
123 Deletes (break|watch)-point #\fBN\fR
124 .IP \fBcond\ N\fR
125 Removes any existing condition to (break|watch)-point \fBN\fR
126 .IP \fBcond\ N\ <expr>\fR
127 Adds condition \fB<expr>\fR to (break|watch)-point
128 #\fBN\fR. \fB<expr>\fR will be evaluated each time the
129 (break|watch)-point is hit. If the result is a zero value, the
130 breakpoint isn't triggered.
131 .IP \fBbreak\ *\ N\fR
132 Adds a breakpoint at address \fBN\fR
133 .IP \fBbreak\ <id>\fR
134 Adds a breakpoint at the address of symbol \fB<id>\fR
135 .IP \fBbreak <id> N\fR
136 Adds a breakpoint at the line \fBN\fR inside symbol \fB<id>\fR.
137 .IP \fBbreak\ N\fR
138 Adds a breakpoint at line \fBN\fR of current source file.
139 .IP \fBbreak\fR
140 Adds a breakpoint at current \f$PC\fR address.
141 .IP \fBwatch\ *\ N\fR
142 Adds a watch command (on write) at address \fBN\fR (on 4 bytes).
143 .IP \fBwatch\ <id>\fR
144 Adds a watch command (on write) at the address of symbol
145 \fB<id>\fR. Size depends on size of \fB<id>\fR.
146 .IP \fBinfo\ break\fR
147 Lists all (break|watch)-points (with their state).
149 You can use the symbol \fBEntryPoint\fR to stand for the entry point of the Dll.
151 When setting a (break|watch)-point by \fB<id>\fR, if the symbol cannot
152 be found (for example, the symbol is contained in a not yet loaded
153 module), \fBwinedbg\fR will recall the name of the symbol and will try
154 to set the breakpoint each time a new module is loaded (until it succeeds). 
156 \fIStack manipulation\fR
157 .IP \fBbt\fR
158 Print calling stack of current thread.
159 .IP \fBbt\ N\fR
160 Print calling stack of thread of ID \fBN\fR. Note: this doesn't change
161 the position of the current frame as manipulated by the \fBup\fR &
162 \fBdn\fR commands).
163 .IP \fBup\fR
164 Goes up one frame in current thread's stack
165 .IP \fBup\ N\fR
166 Goes up \fBN\fR frames in current thread's stack
167 .IP \fBdn\fR
168 Goes down one frame in current thread's stack
169 .IP \fBdn\ N\fR
170 Goes down \fBN\fR frames in current thread's stack
171 .IP \fBframe N\fR
172 Sets \fBN\fR as the current frame for current thread's stack.
173 .IP \fBinfo\ locals\fR
174 Prints information on local variables for current function frame.
176 \fIDirectory & source file manipulation\fR
177 .IP \fBshow\ dir\fR
178 Prints the list of dir:s where source files are looked for.
179 .IP \fBdir\ <pathname>\fR
180 Adds \fB<pathname>\fR to the list of dir:s where to look for source
181 files
182 .IP \fBdir\fR
183 Deletes the list of dir:s where to look for source files
184 .IP \fBsymbolfile\ <pathname>\fR
185 Loads external symbol definition symbolfile \fB<pathname>\fR
186 .IP \fBsymbolfile\ <pathname>\ N\fR
187 Loads external symbol definition symbolfile \fB<pathname>\fR (applying
188 an offset of \fBN\fR to addresses)
189 .IP \fBlist\fR
190 Lists 10 source lines forwards from current position.
191 .IP \fBlist\ -\fR
192 Lists 10 source lines backwards from current position
193 .IP \fBlist\ N\fR
194 Lists 10 source lines from line #\fBN\fR in current file
195 .IP \fBlist\ <pathname>:N\fR
196 Lists 10 source lines from line #\fBN\fR in file \fB<pathname>\fR
197 .IP \fBlist\ <id>\fR
198 Lists 10 source lines of function \fB<id>\fR
199 .IP \fBlist\ *\ N\fR
200 Lists 10 source lines from address \fBN\fR
202 You can specify the end target (to change the 10 lines value) using
203 the ',' separator. For example:
205 .IP \fBlist\ 123,\ 234\fR
206 lists source lines from line 123 up to line 234 in current file
208 .IP \fBlist\ foo.c:1,56\fR
209 lists source lines from line 1 up to 56 in file foo.c 
211 \fIDisplaying\fR
213 A display is an expression that's evaluated and printed after the
214 execution of any \fBwinedbg\fR's command.
215 .IP \fBdisplay\fR
216 .IP \fBinfo\ display\fR
217 Lists the active displays
218 .IP \fBdisplay\ <expr>\fR
219 Adds a display for expression \f<expr>\fR
220 .IP \fBdisplay\ /fmt\ <expr>\fR
221 Adds a display for expression \fB<expr>\fR. Printing evaluated
222 \fB<expr>\fR is done using the given format (see \fBprint\ command\fR
223 for more on formats)
224 .IP \fBdel\ display\ N\fR
225 .IP \fBundisplay\ N\fR
226 Deletes display #\fBN\fR
228 \fIDisassembly\fR
229 .IP \fBdisas\fR
230 Disassemble from current position
231 .IP \fBdisas\ <expr>\fR
232 Disassemble from address \fB<expr>\fR
233 .IP \fBdisas\ <expr>,<expr>\fR
234 Disassembles code between addresses specified by the two \fB<expr>\fR:s
236 \fIMemory\ (reading,\ writing,\ typing)\fR
237 .IP \fBx\ <expr>\fR
238 Examines memory at \fB<expr>\fR address
239 .IP \fBx\ /fmt\ <expr>\fR
240 Examines memory at \fB<expr>\fR address using format \fI/fmt\fR
241 .IP \fBprint\ <expr>\fR
242 Prints the value of \fB<expr>\fR (possibly using its type)
243 .IP \fBprint\ /fmt\ <expr>\fR
244 Prints the value of \fB<expr>\fR (possibly using its type)
245 .IP \fBset\ <var>\ =\ <expr>\fR
246 Writes the value of \fB<expr>\fR in \fB<var>\fR variable.
247 .IP \fBwhatis\ <expr>\fR
248 Prints the C type of expression \fB<expr>\fR
250 .IP \fI/fmt\fR
251 is either \fI/<letter>\fR or \fI/<count><letter>\fR. \fI<letter>\fR
252 can be:
253 .RS 4
254 .IP s
255 an ASCII string
256 .IP u
257 an Unicode UTF16 string
258 .IP i
259 instructions (disassemble)
260 .IP x
261 32 bit unsigned hexadecimal integer
262 .IP d
263 32 bit signed decimal integer
264 .IP w
265 16 bit unsigned hexadecimal integer
266 .IP c
267 character (only printable 0x20-0x7f are actually printed)
268 .IP b
269 8 bit unsigned hexadecimal integer
270 .IP g
271 Win32 GUID
274 \fIExpressions\fR
276 Expressions in Wine Debugger are mostly written in a C form. However,
277 there are a few discrepancies:
279 .RS 4
280 Identifiers can take a '!' in their names. This allows mainly to
281 specify a module where to look the module from: \fIUSER32!CreateWindowExA\fR.
283 In cast operation, when specifying a structure or an union, you must
284 use the struct or union key word (even if your program uses a typedef). 
287 When specifying an identifier \fB<id>\fR, if several symbols with
288 this name exist, the debugger will prompt for the symbol you want to
289 use. Pick up the one you want from its number.
291 \fIInformation on Wine's internals\fR
292 .IP \fBinfo\ class\fR
293 Lists all Windows' class registered in Wine
294 .IP \fBinfo\ class\ <id>\fR
295 Prints information on Windows's class \fB<id>\fR
296 .IP \fBinfo\ share\fR
297 Lists all the dynamic libraries loaded in the debugged program
298 (including .so files, NE and PE DLLs)
299 .IP \fBinfo\ share\ N\fR
300 Prints information on module at address \fBN\fR
301 .IP \fBinfo\ regs\fR
302 Prints the value of the CPU registers
303 .IP \fBinfo\ segment\fR
304 Lists all allocated segments (i386 only)
305 .IP \fBinfo\ segment N\fR
306 Prints information on segment \fBN\fR (i386 only)
307 .IP \fBinfo\ stack\fR
308 Prints the values on top of the stack
309 .IP \fBinfo\ map\fR
310 Lists all virtual mappings used by the debugged program
311 .IP \fBinfo\ map\ N\fR
312 Lists all virtual mappings used by the program of pid \fBN\fR
313 .IP \fBinfo\ wnd\fR
314 Displays the window hierarchy starting from the desktop window
315 .IP \fBinfo\ wnd\ N\fR
316 Prints information of Window of handle \fBN\fR
317 .IP \fBinfo\ process\fR
318 Lists all w-processes in Wine session
319 .IP \fBinfo\ thread\fR
320 Lists all w-threads in Wine session
321 .IP \fBinfo\ exception\fR
322 Lists the exception frames (starting from current stack frame)
324 It is possible to turn on and off Wine's debug messages as you are
325 debugging using the \fBset\fR command. 
326 .IP \fBset\ +\ warn\ win\fR
327 Turns on warn on \fB'win'\fR channel
328 .IP \fBset\ +\ win\fR
329 Turns on warn/fixme/err/trace on \fB'win'\fR channel
330 .IP \fBset\ -\ win\fR
331 Turns off warn/fixme/err/trace on \fB'win'\fR channel
332 .IP \fBset\ -\ fixme\fR
333 Turns off the 'fixme' class on all channels
335 .SS Gdb mode:
337 See the \fBgdb\fR documentation for all the \fBgdb\fR commands.
339 However, a few Wine's extension are available, through the
340 \fBmonitor\fR command:
341 .IP \fBmonitor\ wnd\fR
342 Lists all window in the Wine session
343 .IP \fBmonitor proc\fR
344 Lists all processes in the Wine session
345 .IP \fBmonitor mem \fR
346 Displays memory mapping of debugged process
348 .SS Auto mode:
350 Since no user input is possible, no commands are available.
352 .SH ENVIRONMENT
353 .IP \fBWINE_GDB\fR
354 When used in \fBgdb\fR proxy mode, \fBWINE_GDB\fR specifies the name
355 (and the path) of the executable to be used for \fBgdb\fR. \fB"gdb"\fR
356 is used by default.
357 .SH FILES
358 No specific files are used (yet).
359 .SH BUGS
360 A lot.
361 .SH AUTHORS
362 The first version was written by Eric Youngdale.
364 See Wine developer's list for the rest of contributors.
365 .SH "SEE ALSO"
366 .BR winedbg "'s README file"
368 The Winelib User Guide
370 The Wine Developers Guide