ntdll: Implement RtlIsEcCode().
[wine.git] / programs / winedbg / winedbg.man.in
blobc58696ba1c9acb800e3e69e8be7ba72a19da0597
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 Don't launch \fBgdb\fR directly; instead, print the \fBtarget remote\fR
73 GDB command to execute and listen for connection from any GDB-compatible
74 debugger.  Normally, \fB--gdb\fR will start both the proxy debugging server
75 and an instance of \fBgdb\fR for the front end.  This option instructs
76 \fBwinedbg\fR to skip launching of \fBgdb\fR, and instead prints
77 the GDB command that can be used to manually connect to the server.
78 This command is in the form
79 .IP
80 .in +4n
81 .EX
82 target remote localhost:\fI<port>\fR
83 .EE
84 .in
85 .IP
86 where \fI<port>\fR is the TCP port \fBwinedbg\fR's proxy debugging server is bound to.
87 .IP
88 This option allows the user to replace \fBgdb\fR with some other
89 debugger front end, such as \fBddd\fR, \fBkgdb\fR, \fBgdbgui\fR, or Qt Creator.
90 Regardless of whether \fB--no-start\fR is specified, \fBwinedbg\fR will quit
91 after the first connection is hung up (e.g. \fBgdb\fR detaches from the
92 debuggee).
93 .IP \fB--port\fR\ \fIport\fR
94 Start the GDB proxy debugging server on the given port.  If this option is not
95 specified, \fBwinedbg\fR will let the operating system choose any available port.
96 This option can be used in conjunction with \fB--no-start\fR to specify the port the
97 server shall be bound to.
98 .IP \fB--with-xterm\fR
99 This will run the \fBgdb\fR front end in a new
100 .BR xterm (1)
101 window instead of using the current Unix terminal for its interface.
102 This option is ignored if \fB--no-start\fR is
103 specified.
105 In all modes, the rest of the command line, when passed, is used to 
106 identify which program, if any, is to be debugged:
107 .IP \fIprogram_name\fR
108 This is the name of an executable to start for a debugging
109 session.  \fBwinedbg\fR will actually create a process with this
110 executable. If \fIprogram_arguments\fR are also given, they will be
111 used as arguments for creating the process to be debugged.
112 .IP \fIwpid\fR
113 \fBwinedbg\fR will attach to the process whose Windows pid is \fIwpid\fR.
114 Use the \fBinfo proc\fR command within \fBwinedbg\fR to list running processes
115 and their Windows pids.
116 .IP \fBdefault\fR
117 If nothing is specified, you will enter the debugger without any run
118 nor attached process. You'll have to do the job yourself.
120 .SH COMMANDS
121 .SS Default mode, and while reloading a minidump file:
123 Most of commands used in \fBwinedbg\fR are similar to the ones from
124 \fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
125 details. See the \fIgdb\ differences\fR section later on to get a list
126 of variations from \fBgdb\fR commands.
128 \fIMisc. commands\fR
129 .IP \fBabort\fR
130 Aborts the debugger.
131 .IP \fBquit\fR
132 Exits the debugger.
134 \fIProcess handling\fR
135 .IP \fBattach\ \fIN\fR
136 Attach to a Wine process (\fIN\fR is its Windows ID, numeric or hexadecimal).
137 IDs can be obtained using the \fBinfo\ process\fR command.  Note the
138 \fBinfo\ process\fR command returns hexadecimal values
139 .IP 
140 .IP \fBdetach\fR
141 Detach from a Wine-process.
142 .IP \fBthread\ \fIN\fR
143 Change the current thread to \fIN\fR (its Windows TID, numeric or hexadecimal).
145 .IP \fBrun\fR
146 Re-run the same process with the same arguments.
147 Note: all breakpoints of precedent process are no longer available.
148 .IP \fBrun\ \fIarg1\ arg2...\fR
149 Re-run the same process with arguments \fIarg1\ arg2...\fR.
150 Note: all breakpoints of precedent process are no longer available.
152 \fIHelp commands\fR
153 .IP \fBhelp\fR
154 Prints some help on the commands.
155 .IP \fBhelp\ info\fR
156 Prints some help on info commands
158 \fIFlow control commands\fR
159 .IP \fBcont\fR
160 Continue execution until next breakpoint or exception.
161 .IP \fBpass\fR
162 Pass the exception event up to the filter chain.
163 .IP \fBstep\fR
164 Continue execution until next C line of code (enters function call)
165 .IP \fBnext\fR
166 Continue execution until next C line of code (doesn't enter function
167 call)
168 .IP \fBstepi\fR
169 Execute next assembly instruction (enters function call)
170 .IP \fBnexti\fR
171 Execute next assembly instruction (doesn't enter function call)
172 .IP \fBfinish\fR
173 Execute until return of current function is reached.
175 \fBcont\fR, \fBstep\fR, \fBnext\fR, \fBstepi\fR, \fBnexti\fR can be
176 postfixed by a number (N), meaning that the command must be executed N
177 times before control is returned to the user.
179 \fIBreakpoints, watchpoints
180 .IP \fBenable\ \fIN\fR
181 Enables (break|watch)-point \fIN\fR
182 .IP \fBdisable\ \fIN\fR
183 Disables (break|watch)-point \fIN\fR
184 .IP \fBdelete\ \fIN\fR
185 Deletes (break|watch)-point \fIN\fR
186 .IP \fBcond\ \fIN\fR
187 Removes any existing condition to (break|watch)-point \fIN\fR
188 .IP \fBcond\ \fIN\ expr\fR
189 Adds condition \fIexpr\fR to (break|watch)-point
190 \fIN\fR. \fIexpr\fR will be evaluated each time the
191 (break|watch)-point is hit. If the result is a zero value, the
192 breakpoint isn't triggered.
193 .IP \fBbreak\ *\ \fIN\fR
194 Adds a breakpoint at address \fIN\fR
195 .IP \fBbreak\ \fIid\fR
196 Adds a breakpoint at the address of symbol \fIid\fR
197 .IP \fBbreak\ \fIid\ N\fR
198 Adds a breakpoint at the line \fIN\fR inside symbol \fIid\fR.
199 .IP \fBbreak\ \fIN\fR
200 Adds a breakpoint at line \fIN\fR of current source file.
201 .IP \fBbreak\fR
202 Adds a breakpoint at current \fB$PC\fR address.
203 .IP \fBwatch\ *\ \fIN\fR
204 Adds a watch command (on write) at address \fIN\fR (on 4 bytes).
205 .IP \fBwatch\ \fIid\fR
206 Adds a watch command (on write) at the address of symbol
207 \fIid\fR. Size depends on size of \fIid\fR.
208 .IP \fBrwatch\ *\ \fIN\fR
209 Adds a watch command (on read) at address \fIN\fR (on 4 bytes).
210 .IP \fBrwatch\ \fIid\fR
211 Adds a watch command (on read) at the address of symbol
212 \fIid\fR. Size depends on size of \fIid\fR.
213 .IP \fBinfo\ break\fR
214 Lists all (break|watch)-points (with their state).
216 You can use the symbol \fBEntryPoint\fR to stand for the entry point of the Dll.
218 When setting a (break|watch)-point by \fIid\fR, if the symbol cannot
219 be found (for example, the symbol is contained in a not yet loaded
220 module), \fBwinedbg\fR will recall the name of the symbol and will try
221 to set the breakpoint each time a new module is loaded (until it succeeds). 
223 \fIStack manipulation\fR
224 .IP \fBbt\fR
225 Print calling stack of current thread.
226 .IP \fBbt\ \fIN\fR
227 Print calling stack of thread of ID \fIN\fR. Note: this doesn't change
228 the position of the current frame as manipulated by the \fBup\fR &
229 \fBdn\fR commands).
230 .IP \fBup\fR
231 Goes up one frame in current thread's stack
232 .IP \fBup\ \fIN\fR
233 Goes up \fIN\fR frames in current thread's stack
234 .IP \fBdn\fR
235 Goes down one frame in current thread's stack
236 .IP \fBdn\ \fIN\fR
237 Goes down \fIN\fR frames in current thread's stack
238 .IP \fBframe\ \fIN\fR
239 Sets \fIN\fR as the current frame for current thread's stack.
240 .IP \fBinfo\ locals\fR
241 Prints information on local variables for current function frame.
243 \fIDirectory & source file manipulation\fR
244 .IP \fBshow\ dir\fR
245 Prints the list of dirs where source files are looked for.
246 .IP \fBdir\ \fIpathname\fR
247 Adds \fIpathname\fR to the list of dirs where to look for source
248 files
249 .IP \fBdir\fR
250 Deletes the list of dirs where to look for source files
251 .IP \fBsymbolfile\ \fIpathname\fR
252 Loads external symbol definition file \fIpathname\fR
253 .IP \fBsymbolfile\ \fIpathname\ N\fR
254 Loads external symbol definition file \fIpathname\fR (applying
255 an offset of \fIN\fR to addresses)
256 .IP \fBlist\fR
257 Lists 10 source lines forwards from current position.
258 .IP \fBlist\ -\fR
259 Lists 10 source lines backwards from current position
260 .IP \fBlist\ \fIN\fR
261 Lists 10 source lines from line \fIN\fR in current file
262 .IP \fBlist\ \fIpathname\fB:\fIN\fR
263 Lists 10 source lines from line \fIN\fR in file \fIpathname\fR
264 .IP \fBlist\ \fIid\fR
265 Lists 10 source lines of function \fIid\fR
266 .IP \fBlist\ *\ \fIN\fR
267 Lists 10 source lines from address \fIN\fR
269 You can specify the end target (to change the 10 lines value) using
270 the ',' separator. For example:
271 .IP \fBlist\ 123,\ 234\fR
272 lists source lines from line 123 up to line 234 in current file
273 .IP \fBlist\ foo.c:1,56\fR
274 lists source lines from line 1 up to 56 in file foo.c
276 \fIDisplaying\fR
278 A display is an expression that's evaluated and printed after the
279 execution of any \fBwinedbg\fR command.
280 .IP \fBdisplay\fR
281 .IP \fBinfo\ display\fR
282 Lists the active displays
283 .IP \fBdisplay\ \fIexpr\fR
284 Adds a display for expression \fIexpr\fR
285 .IP \fBdisplay\ /\fIfmt\ \fIexpr\fR
286 Adds a display for expression \fIexpr\fR. Printing evaluated
287 \fIexpr\fR is done using the given format (see \fBprint\ command\fR
288 for more on formats)
289 .IP \fBdel\ display\ \fIN\fR
290 .IP \fBundisplay\ \fIN\fR
291 Deletes display \fIN\fR
293 \fIDisassembly\fR
294 .IP \fBdisas\fR
295 Disassemble from current position
296 .IP \fBdisas\ \fIexpr\fR
297 Disassemble from address \fIexpr\fR
298 .IP \fBdisas\ \fIexpr\fB,\fIexpr\fR
299 Disassembles code between addresses specified by the two expressions
301 \fIMemory\ (reading,\ writing,\ typing)\fR
302 .IP \fBx\ \fIexpr\fR
303 Examines memory at address \fIexpr\fR
304 .IP \fBx\ /\fIfmt\ expr\fR
305 Examines memory at address \fIexpr\fR using format \fIfmt\fR
306 .IP \fBprint\ \fIexpr\fR
307 Prints the value of \fIexpr\fR (possibly using its type)
308 .IP \fBprint\ /\fIfmt\ expr\fR
309 Prints the value of \fIexpr\fR (possibly using its type)
310 .IP \fBset\ \fIvar\fB\ =\ \fIexpr\fR
311 Writes the value of \fIexpr\fR in \fIvar\fR variable
312 .IP \fBwhatis\ \fIexpr\fR
313 Prints the C type of expression \fIexpr\fR
315 .IP \fIfmt\fR
316 is either \fIletter\fR or \fIcount letter\fR, where \fIletter\fR
317 can be:
318 .RS 4
319 .IP s
320 an ASCII string
321 .IP u
322 a UTF16 Unicode string
323 .IP i
324 instructions (disassemble)
325 .IP x
326 32-bit unsigned hexadecimal integer
327 .IP d
328 32-bit signed decimal integer
329 .IP w
330 16-bit unsigned hexadecimal integer
331 .IP c
332 character (only printable 0x20-0x7f are actually printed)
333 .IP b
334 8-bit unsigned hexadecimal integer
335 .IP g
336 Win32 GUID
339 \fIExpressions\fR
341 Expressions in Wine Debugger are mostly written in a C form. However,
342 there are a few discrepancies:
344 .RS 4
345 Identifiers can take a '!' in their names. This allows mainly to
346 specify a module where to look the ID from, e.g. \fIUSER32!CreateWindowExA\fR.
348 In a cast operation, when specifying a structure or a union, you must
349 use the struct or union keyword (even if your program uses a typedef).
352 When specifying an identifier, if several symbols with
353 this name exist, the debugger will prompt for the symbol you want to
354 use. Pick up the one you want from its number.
356 \fIMisc.\fR
358 .BI "minidump " file.mdmp
359 saves the debugging context of the debuggee into a minidump file called 
360 \fIfile.mdmp\fR.
362 \fIInformation on Wine internals\fR
363 .IP \fBinfo\ class\fR
364 Lists all Windows classes registered in Wine
365 .IP \fBinfo\ class\ \fIid\fR
366 Prints information on Windows class \fIid\fR
367 .IP \fBinfo\ share\fR
368 Lists all the dynamic libraries loaded in the debugged program
369 (including .so files, NE and PE DLLs)
370 .IP \fBinfo\ share\ \fIN\fR
371 Prints information on module at address \fIN\fR
372 .IP \fBinfo\ regs\fR
373 Prints the value of the CPU registers
374 .IP \fBinfo\ all-regs\fR
375 Prints the value of the CPU and Floating Point registers
376 .IP \fBinfo\ segment\fR
377 Lists all allocated segments (i386 only)
378 .IP \fBinfo\ segment\ \fIN\fR
379 Prints information on segment \fIN\fR (i386 only)
380 .IP \fBinfo\ stack\fR
381 Prints the values on top of the stack
382 .IP \fBinfo\ map\fR
383 Lists all virtual mappings used by the debugged program
384 .IP \fBinfo\ map\ \fIN\fR
385 Lists all virtual mappings used by the program of Windows pid \fIN\fR
386 .IP \fBinfo\ wnd\fR
387 Displays the window hierarchy starting from the desktop window
388 .IP \fBinfo\ wnd\ \fIN\fR
389 Prints information of Window of handle \fIN\fR
390 .IP \fBinfo\ process\fR
391 Lists all w-processes in Wine session
392 .IP \fBinfo\ thread\fR
393 Lists all w-threads in Wine session
394 .IP \fBinfo\ frame\fR
395 Lists the exception frames (starting from current stack frame). You
396 can also pass, as optional argument, a thread id (instead of current
397 thread) to examine its exception frames.
399 Debug messages can be turned on and off as you are debugging using
400 the \fBset\fR command, but only for channels initialized with the
401 \fIWINEDEBUG\fR environment variable.
402 .IP \fBset\ warn\ +\ \fIwin\fR
403 Turns on warn on \fIwin\fR channel
404 .IP \fBset\ +\ \fIwin\fR
405 Turns on warn/fixme/err/trace on \fIwin\fR channel
406 .IP \fBset\ -\ \fIwin\fR
407 Turns off warn/fixme/err/trace on \fIwin\fR channel
408 .IP \fBset\ fixme\ -\ all\fR
409 Turns off fixme class on all channels
411 .SS Gdb mode:
413 See the \fBgdb\fR documentation for all the \fBgdb\fR commands.
415 However, a few Wine extensions are available, through the
416 \fBmonitor\fR command:
417 .IP \fBmonitor\ wnd\fR
418 Lists all windows in the Wine session
419 .IP \fBmonitor\ proc\fR
420 Lists all processes in the Wine session
421 .IP \fBmonitor\ mem\fR
422 Displays memory mapping of debugged process
424 .SS Auto and minidump modes:
426 Since no user input is possible, no commands are available.
428 .SH ENVIRONMENT
429 .IP \fBWINE_GDB\fR
430 When used in \fBgdb\fR proxy mode, \fBWINE_GDB\fR specifies the name
431 (and the path) of the executable to be used for \fBgdb\fR. "gdb"
432 is used by default.
433 .SH AUTHORS
434 The first version was written by Eric Youngdale.
436 See Wine developers list for the rest of contributors.
437 .SH BUGS
438 Bugs can be reported on the
439 .UR https://bugs.winehq.org
440 .B Wine bug tracker
441 .UE .
442 .SH AVAILABILITY
443 .B winedbg
444 is part of the Wine distribution, which is available through WineHQ,
446 .UR https://www.winehq.org/
447 .B Wine development headquarters
448 .UE .
449 .SH "SEE ALSO"
450 .BR wine (1),
452 .UR https://www.winehq.org/help
453 .B Wine documentation and support
454 .UE .