hidclass.sys: Use IoRegisterDeviceInterface.
[wine.git] / programs / winedbg / winedbg.man.in
blob6f38bc07b97ddb9dda55631e14d43a97d0f0751c
1 .TH WINEDBG 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
2 .SH NAME
3 winedbg \- Wine debugger
4 .SH SYNOPSIS
5 .B winedbg
6 .RI "[ " options " ] [ " program_name " [ " program_arguments " ] | " wpid " ]"
7 .PP
8 .B winedbg --gdb
9 .RI "[ " options " ] [ " program_name " [ " program_arguments " ] | " wpid " ]"
10 .PP
11 .BI "winedbg --auto " wpid
12 .PP
13 .B winedbg --minidump
14 .RI "[ " file.mdmp " ] " wpid
15 .PP
16 .BI "winedbg " file.mdmp
17 .SH DESCRIPTION
18 .B winedbg
19 is a debugger for Wine. It allows:
20 .RS 4
21 .nf
22 + debugging native Win32 applications
23 + debugging Winelib applications
24 + being a drop-in replacement for Dr Watson
25 .fi
26 .RE
27 .PP
29 .SH MODES
30 \fBwinedbg\fR can be used in five modes.  The first argument to the
31 program determines the mode winedbg will run in.
32 .IP \fBdefault\fR
33 Without any explicit mode, this is standard \fBwinedbg\fR operating
34 mode. \fBwinedbg\fR will act as the front end for the user.
35 .IP \fB--gdb\fR
36 \fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
37 the front end for command handling, and \fBwinedbg\fR will proxy all
38 debugging requests from \fBgdb\fR to the Win32 APIs.
39 .IP \fB--auto\fR
40 This mode is used when \fBwinedbg\fR is set up in \fIAeDebug\fR
41 registry entry as the default debugger. \fBwinedbg\fR will then
42 display basic information about a crash. This is useful for users
43 who don't want to debug a crash, but rather gather relevant
44 information about the crash to be sent to developers.
45 .IP \fB--minidump\fR
46 This mode is similar to the \fB--auto\fR one, except that instead of
47 printing the information on the screen (as \fB--auto\fR does), it's
48 saved into a minidump file. The name of the file is either passed on
49 the command line, or generated by \fBWineDbg\fR when none is given.
50 This file could later on be reloaded into \fBwinedbg\fR for further
51 examination.
52 .IP \fBfile.mdmp\fR
53 In this mode \fBwinedbg\fR reloads the state of a debuggee which
54 has been saved into a minidump file. See either the \fBminidump\fR
55 command below, or the \fB--minidump mode\fR.
57 .SH OPTIONS
58 When in \fBdefault\fR mode, the following options are available:
59 .PP
60 .IP \fB--command\ \fIstring\fR
61 \fBwinedbg\fR will execute the command \fIstring\fR as if it was keyed on
62 winedbg command line, and then will exit. This can be handy for
63 getting the pid of running processes (winedbg --command "info proc").
64 .IP \fB--file\ \fIfilename\fR
65 \fBwinedbg\fR will execute the list of commands contained in file
66 filename as if they were keyed on winedbg command line, and then
67 will exit.
68 .PP
69 When in \fBgdb\fR proxy mode, the following options are available:
70 .PP
71 .IP \fB--no-start\fR
72 \fBgdb\fR will not be automatically
73 started. Relevant information for starting \fBgdb\fR is printed on
74 screen. This is somehow useful when not directly using \fBgdb\fR but
75 some graphical front-ends, like \fBddd\fR or \fBkgbd\fR. 
76 .IP \fB--port\fR\ \fIport\fR
77 Start the \fBgdb\fR server on the given port. If this option is not
78 specified, a randomly chosen port will be used. If \fB--no-start\fR is
79 specified, the port used will be printed on startup.
80 .IP \fB--with-xterm\fR
81 This will run \fBgdb\fR in its own xterm instead of using the current
82 Unix console for textual display.
83 .PP
84 In all modes, the rest of the command line, when passed, is used to 
85 identify which programs, if any, has to debugged:
86 .IP \fIprogram_name\fR
87 This is the name of an executable to start for a debugging
88 session.  \fBwinedbg\fR will actually create a process with this
89 executable. If \fIprograms_arguments\fR are also given, they will be
90 used as arguments for creating the process to be debugged.
91 .IP \fIwpid\fR
92 \fBwinedbg\fR will attach to the process which Windows pid is \fIwpid\fR.
93 Use the \fBinfo proc\fR command within \fBwinedbg\fR to list running processes
94 and their Windows pids.
95 .IP \fBdefault\fR
96 If nothing is specified, you will enter the debugger without any run
97 nor attached process. You'll have to do the job yourself.
99 .SH COMMANDS
100 .SS Default mode, and while reloading a minidump file:
102 Most of commands used in \fBwinedbg\fR are similar to the ones from
103 \fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
104 details. See the \fIgdb\ differences\fR section later on to get a list
105 of variations from \fBgdb\fR commands.
107 \fIMisc. commands\fR
108 .IP \fBabort\fR
109 Aborts the debugger.
110 .IP \fBquit\fR
111 Exits the debugger.
112 .IP \fBattach\ \fIN\fR
113 Attach to a Wine process (\fIN\fR is its Windows ID, numeric or hexadecimal).
114 IDs can be obtained using the \fBinfo\ process\fR command.  Note the
115 \fBinfo\ process\fR command returns hexadecimal values
116 .IP 
117 .IP \fBdetach\fR
118 Detach from a Wine-process.
120 \fIHelp commands\fR
121 .IP \fBhelp\fR
122 Prints some help on the commands.
123 .IP \fBhelp\ info\fR
124 Prints some help on info commands
126 \fIFlow control commands\fR
127 .IP \fBcont\fR
128 Continue execution until next breakpoint or exception.
129 .IP \fBpass\fR
130 Pass the exception event up to the filter chain.
131 .IP \fBstep\fR
132 Continue execution until next C line of code (enters function call)
133 .IP \fBnext\fR
134 Continue execution until next C line of code (doesn't enter function
135 call)
136 .IP \fBstepi\fR
137 Execute next assembly instruction (enters function call)
138 .IP \fBnexti\fR
139 Execute next assembly instruction (doesn't enter function call)
140 .IP \fBfinish\fR
141 Execute until return of current function is reached.
143 \fBcont\fR, \fBstep\fR, \fBnext\fR, \fBstepi\fR, \fBnexti\fR can be
144 postfixed by a number (N), meaning that the command must be executed N
145 times before control is returned to the user.
147 \fIBreakpoints, watchpoints
148 .IP \fBenable\ \fIN\fR
149 Enables (break|watch)-point \fIN\fR
150 .IP \fBdisable\ \fIN\fR
151 Disables (break|watch)-point \fIN\fR
152 .IP \fBdelete\ \fIN\fR
153 Deletes (break|watch)-point \fIN\fR
154 .IP \fBcond\ \fIN\fR
155 Removes any existing condition to (break|watch)-point \fIN\fR
156 .IP \fBcond\ \fIN\ expr\fR
157 Adds condition \fIexpr\fR to (break|watch)-point
158 \fIN\fR. \fIexpr\fR will be evaluated each time the
159 (break|watch)-point is hit. If the result is a zero value, the
160 breakpoint isn't triggered.
161 .IP \fBbreak\ *\ \fIN\fR
162 Adds a breakpoint at address \fIN\fR
163 .IP \fBbreak\ \fIid\fR
164 Adds a breakpoint at the address of symbol \fIid\fR
165 .IP \fBbreak\ \fIid\ N\fR
166 Adds a breakpoint at the line \fIN\fR inside symbol \fIid\fR.
167 .IP \fBbreak\ \fIN\fR
168 Adds a breakpoint at line \fIN\fR of current source file.
169 .IP \fBbreak\fR
170 Adds a breakpoint at current \fB$PC\fR address.
171 .IP \fBwatch\ *\ \fIN\fR
172 Adds a watch command (on write) at address \fIN\fR (on 4 bytes).
173 .IP \fBwatch\ \fIid\fR
174 Adds a watch command (on write) at the address of symbol
175 \fIid\fR. Size depends on size of \fIid\fR.
176 .IP \fBrwatch\ *\ \fIN\fR
177 Adds a watch command (on read) at address \fIN\fR (on 4 bytes).
178 .IP \fBrwatch\ \fIid\fR
179 Adds a watch command (on read) at the address of symbol
180 \fIid\fR. Size depends on size of \fIid\fR.
181 .IP \fBinfo\ break\fR
182 Lists all (break|watch)-points (with their state).
184 You can use the symbol \fBEntryPoint\fR to stand for the entry point of the Dll.
186 When setting a (break|watch)-point by \fIid\fR, if the symbol cannot
187 be found (for example, the symbol is contained in a not yet loaded
188 module), \fBwinedbg\fR will recall the name of the symbol and will try
189 to set the breakpoint each time a new module is loaded (until it succeeds). 
191 \fIStack manipulation\fR
192 .IP \fBbt\fR
193 Print calling stack of current thread.
194 .IP \fBbt\ \fIN\fR
195 Print calling stack of thread of ID \fIN\fR. Note: this doesn't change
196 the position of the current frame as manipulated by the \fBup\fR &
197 \fBdn\fR commands).
198 .IP \fBup\fR
199 Goes up one frame in current thread's stack
200 .IP \fBup\ \fIN\fR
201 Goes up \fIN\fR frames in current thread's stack
202 .IP \fBdn\fR
203 Goes down one frame in current thread's stack
204 .IP \fBdn\ \fIN\fR
205 Goes down \fIN\fR frames in current thread's stack
206 .IP \fBframe\ \fIN\fR
207 Sets \fIN\fR as the current frame for current thread's stack.
208 .IP \fBinfo\ locals\fR
209 Prints information on local variables for current function frame.
211 \fIDirectory & source file manipulation\fR
212 .IP \fBshow\ dir\fR
213 Prints the list of dirs where source files are looked for.
214 .IP \fBdir\ \fIpathname\fR
215 Adds \fIpathname\fR to the list of dirs where to look for source
216 files
217 .IP \fBdir\fR
218 Deletes the list of dirs where to look for source files
219 .IP \fBsymbolfile\ \fIpathname\fR
220 Loads external symbol definition file \fIpathname\fR
221 .IP \fBsymbolfile\ \fIpathname\ N\fR
222 Loads external symbol definition file \fIpathname\fR (applying
223 an offset of \fIN\fR to addresses)
224 .IP \fBlist\fR
225 Lists 10 source lines forwards from current position.
226 .IP \fBlist\ -\fR
227 Lists 10 source lines backwards from current position
228 .IP \fBlist\ \fIN\fR
229 Lists 10 source lines from line \fIN\fR in current file
230 .IP \fBlist\ \fIpathname\fB:\fIN\fR
231 Lists 10 source lines from line \fIN\fR in file \fIpathname\fR
232 .IP \fBlist\ \fIid\fR
233 Lists 10 source lines of function \fIid\fR
234 .IP \fBlist\ *\ \fIN\fR
235 Lists 10 source lines from address \fIN\fR
237 You can specify the end target (to change the 10 lines value) using
238 the ',' separator. For example:
239 .IP \fBlist\ 123,\ 234\fR
240 lists source lines from line 123 up to line 234 in current file
241 .IP \fBlist\ foo.c:1,56\fR
242 lists source lines from line 1 up to 56 in file foo.c
244 \fIDisplaying\fR
246 A display is an expression that's evaluated and printed after the
247 execution of any \fBwinedbg\fR command.
248 .IP \fBdisplay\fR
249 .IP \fBinfo\ display\fR
250 Lists the active displays
251 .IP \fBdisplay\ \fIexpr\fR
252 Adds a display for expression \fIexpr\fR
253 .IP \fBdisplay\ /\fIfmt\ \fIexpr\fR
254 Adds a display for expression \fIexpr\fR. Printing evaluated
255 \fIexpr\fR is done using the given format (see \fBprint\ command\fR
256 for more on formats)
257 .IP \fBdel\ display\ \fIN\fR
258 .IP \fBundisplay\ \fIN\fR
259 Deletes display \fIN\fR
261 \fIDisassembly\fR
262 .IP \fBdisas\fR
263 Disassemble from current position
264 .IP \fBdisas\ \fIexpr\fR
265 Disassemble from address \fIexpr\fR
266 .IP \fBdisas\ \fIexpr\fB,\fIexpr\fR
267 Disassembles code between addresses specified by the two expressions
269 \fIMemory\ (reading,\ writing,\ typing)\fR
270 .IP \fBx\ \fIexpr\fR
271 Examines memory at address \fIexpr\fR
272 .IP \fBx\ /\fIfmt\ expr\fR
273 Examines memory at address \fIexpr\fR using format \fIfmt\fR
274 .IP \fBprint\ \fIexpr\fR
275 Prints the value of \fIexpr\fR (possibly using its type)
276 .IP \fBprint\ /\fIfmt\ expr\fR
277 Prints the value of \fIexpr\fR (possibly using its type)
278 .IP \fBset\ \fIvar\fB\ =\ \fIexpr\fR
279 Writes the value of \fIexpr\fR in \fIvar\fR variable
280 .IP \fBwhatis\ \fIexpr\fR
281 Prints the C type of expression \fIexpr\fR
283 .IP \fIfmt\fR
284 is either \fIletter\fR or \fIcount letter\fR, where \fIletter\fR
285 can be:
286 .RS 4
287 .IP s
288 an ASCII string
289 .IP u
290 a UTF16 Unicode string
291 .IP i
292 instructions (disassemble)
293 .IP x
294 32-bit unsigned hexadecimal integer
295 .IP d
296 32-bit signed decimal integer
297 .IP w
298 16-bit unsigned hexadecimal integer
299 .IP c
300 character (only printable 0x20-0x7f are actually printed)
301 .IP b
302 8-bit unsigned hexadecimal integer
303 .IP g
304 Win32 GUID
307 \fIExpressions\fR
309 Expressions in Wine Debugger are mostly written in a C form. However,
310 there are a few discrepancies:
312 .RS 4
313 Identifiers can take a '!' in their names. This allows mainly to
314 specify a module where to look the ID from, e.g. \fIUSER32!CreateWindowExA\fR.
316 In a cast operation, when specifying a structure or a union, you must
317 use the struct or union keyword (even if your program uses a typedef).
320 When specifying an identifier, if several symbols with
321 this name exist, the debugger will prompt for the symbol you want to
322 use. Pick up the one you want from its number.
324 \fIMisc.\fR
326 .BI "minidump " file.mdmp
327 saves the debugging context of the debuggee into a minidump file called 
328 \fIfile.mdmp\fR.
330 \fIInformation on Wine internals\fR
331 .IP \fBinfo\ class\fR
332 Lists all Windows classes registered in Wine
333 .IP \fBinfo\ class\ \fIid\fR
334 Prints information on Windows class \fIid\fR
335 .IP \fBinfo\ share\fR
336 Lists all the dynamic libraries loaded in the debugged program
337 (including .so files, NE and PE DLLs)
338 .IP \fBinfo\ share\ \fIN\fR
339 Prints information on module at address \fIN\fR
340 .IP \fBinfo\ regs\fR
341 Prints the value of the CPU registers
342 .IP \fBinfo\ all-regs\fR
343 Prints the value of the CPU and Floating Point registers
344 .IP \fBinfo\ segment\fR
345 Lists all allocated segments (i386 only)
346 .IP \fBinfo\ segment\ \fIN\fR
347 Prints information on segment \fIN\fR (i386 only)
348 .IP \fBinfo\ stack\fR
349 Prints the values on top of the stack
350 .IP \fBinfo\ map\fR
351 Lists all virtual mappings used by the debugged program
352 .IP \fBinfo\ map\ \fIN\fR
353 Lists all virtual mappings used by the program of Windows pid \fIN\fR
354 .IP \fBinfo\ wnd\fR
355 Displays the window hierarchy starting from the desktop window
356 .IP \fBinfo\ wnd\ \fIN\fR
357 Prints information of Window of handle \fIN\fR
358 .IP \fBinfo\ process\fR
359 Lists all w-processes in Wine session
360 .IP \fBinfo\ thread\fR
361 Lists all w-threads in Wine session
362 .IP \fBinfo\ frame\fR
363 Lists the exception frames (starting from current stack frame). You
364 can also pass, as optional argument, a thread id (instead of current
365 thread) to examine its exception frames.
367 Debug messages can be turned on and off as you are debugging using
368 the \fBset\fR command, but only for channels initialized with the
369 \fIWINEDEBUG\fR environment variable.
370 .IP \fBset\ warn\ +\ \fIwin\fR
371 Turns on warn on \fIwin\fR channel
372 .IP \fBset\ +\ \fIwin\fR
373 Turns on warn/fixme/err/trace on \fIwin\fR channel
374 .IP \fBset\ -\ \fIwin\fR
375 Turns off warn/fixme/err/trace on \fIwin\fR channel
376 .IP \fBset\ fixme\ -\ all\fR
377 Turns off fixme class on all channels
379 .SS Gdb mode:
381 See the \fBgdb\fR documentation for all the \fBgdb\fR commands.
383 However, a few Wine extensions are available, through the
384 \fBmonitor\fR command:
385 .IP \fBmonitor\ wnd\fR
386 Lists all windows in the Wine session
387 .IP \fBmonitor\ proc\fR
388 Lists all processes in the Wine session
389 .IP \fBmonitor\ mem\fR
390 Displays memory mapping of debugged process
392 .SS Auto and minidump modes:
394 Since no user input is possible, no commands are available.
396 .SH ENVIRONMENT
397 .IP \fBWINE_GDB\fR
398 When used in \fBgdb\fR proxy mode, \fBWINE_GDB\fR specifies the name
399 (and the path) of the executable to be used for \fBgdb\fR. "gdb"
400 is used by default.
401 .SH AUTHORS
402 The first version was written by Eric Youngdale.
404 See Wine developers list for the rest of contributors.
405 .SH BUGS
406 Bugs can be reported on the
407 .UR https://bugs.winehq.org
408 .B Wine bug tracker
409 .UE .
410 .SH AVAILABILITY
411 .B winedbg
412 is part of the Wine distribution, which is available through WineHQ,
414 .UR https://www.winehq.org/
415 .B Wine development headquarters
416 .UE .
417 .SH "SEE ALSO"
418 .BR wine (1),
420 .UR https://www.winehq.org/help
421 .B Wine documentation and support
422 .UE .