winedbg.man.in 15.5 KB
Newer Older
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 8
.PP
.B winedbg --gdb
9
.RI "[ " options " ] [ " program_name " [ " program_arguments " ] | " wpid " ]"
10
.PP
11
.BI "winedbg --auto " wpid
12 13
.PP
.B winedbg --minidump
14
.RI "[ " file.mdmp " ] " wpid
15 16
.PP
.BI "winedbg " file.mdmp
17 18 19 20 21
.SH DESCRIPTION
.B winedbg
is a debugger for Wine. It allows:
.RS 4
.nf
22
+ debugging native Win32 applications
23
+ debugging Winelib applications
24
+ being a drop-in replacement for Dr Watson
25
.fi
26 27 28 29
.RE
.PP

.SH MODES
30
\fBwinedbg\fR can be used in five modes.  The first argument to the
31 32 33 34
program determines the mode winedbg will run in.
.IP \fBdefault\fR
Without any explicit mode, this is standard \fBwinedbg\fR operating
mode. \fBwinedbg\fR will act as the front end for the user.
35 36 37 38
.IP \fB--gdb\fR
\fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
the front end for command handling, and \fBwinedbg\fR will proxy all
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
Jon Griffiths's avatar
Jon Griffiths committed
41
registry entry as the default debugger. \fBwinedbg\fR will then
42
display basic information about a crash. This is useful for users
43 44
who don't want to debug a crash, but rather gather relevant
information about the crash to be sent to developers.
45 46 47 48 49 50 51 52
.IP \fB--minidump\fR
This mode is similar to the \fB--auto\fR one, except that instead of
printing the information on the screen (as \fB--auto\fR does), it's
saved into a minidump file. The name of the file is either passed on
the command line, or generated by \fBWineDbg\fR when none is given.
This file could later on be reloaded into \fBwinedbg\fR for further
examination.
.IP \fBfile.mdmp\fR
53 54
In this mode \fBwinedbg\fR reloads the state of a debuggee which
has been saved into a minidump file. See either the \fBminidump\fR
55
command below, or the \fB--minidump mode\fR.
56 57

.SH OPTIONS
58 59
When in \fBdefault\fR mode, the following options are available:
.PP
60 61 62
.IP \fB--command\ \fIstring\fR
\fBwinedbg\fR will execute the command \fIstring\fR as if it was keyed on
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 68 69
will exit.
.PP
When in \fBgdb\fR proxy mode, the following options are available:
70
.PP
71
.IP \fB--no-start\fR
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
Don't launch \fBgdb\fR directly; instead, print the \fBtarget remote\fR
GDB command to execute and listen for connection from any GDB-compatible
debugger.  Normally, \fB--gdb\fR will start both the proxy debugging server
and an instance of \fBgdb\fR for the front end.  This option instructs
\fBwinedbg\fR to skip launching of \fBgdb\fR, and instead prints
the GDB command that can be used to manually connect to the server.
This command is in the form
.IP
.in +4n
.EX
target remote localhost:\fI<port>\fR
.EE
.in
.IP
where \fI<port>\fR is the TCP port \fBwinedbg\fR's proxy debugging server is bound to.
.IP
This option allows the user to replace \fBgdb\fR with some other
debugger front end, such as \fBddd\fR, \fBkgdb\fR, \fBgdbgui\fR, or Qt Creator.
Regardless of whether \fB--no-start\fR is specified, \fBwinedbg\fR will quit
after the first connection is hung up (e.g. \fBgdb\fR detaches from the
debuggee).
93
.IP \fB--port\fR\ \fIport\fR
94 95 96 97
Start the GDB proxy debugging server on the given port.  If this option is not
specified, \fBwinedbg\fR will let the operating system choose any available port.
This option can be used in conjunction with \fB--no-start\fR to specify the port the
server shall be bound to.
98
.IP \fB--with-xterm\fR
99 100 101 102 103
This will run the \fBgdb\fR front end in a new
.BR xterm (1)
window instead of using the current Unix terminal for its interface.
This option is ignored if \fB--no-start\fR is
specified.
104
.PP
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 109
This is the name of an executable to start for a debugging
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 115
Use the \fBinfo proc\fR command within \fBwinedbg\fR to list running processes
and their Windows pids.
116
.IP \fBdefault\fR
117 118 119 120
If nothing is specified, you will enter the debugger without any run
nor attached process. You'll have to do the job yourself.

.SH COMMANDS
121
.SS Default mode, and while reloading a minidump file:
122 123 124 125 126 127 128 129 130 131 132
.PP
Most of commands used in \fBwinedbg\fR are similar to the ones from
\fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
details. See the \fIgdb\ differences\fR section later on to get a list
of variations from \fBgdb\fR commands.
.PP
\fIMisc. commands\fR
.IP \fBabort\fR
Aborts the debugger.
.IP \fBquit\fR
Exits the debugger.
133 134
.PP
\fIProcess handling\fR
135
.IP \fBattach\ \fIN\fR
136
Attach to a Wine process (\fIN\fR is its Windows ID, numeric or hexadecimal).
137 138 139 140 141
IDs can be obtained using the \fBinfo\ process\fR command.  Note the
\fBinfo\ process\fR command returns hexadecimal values
.IP 
.IP \fBdetach\fR
Detach from a Wine-process.
142 143 144
.IP \fBthread\ \fIN\fR
Change the current thread to \fIN\fR (its Windows TID, numeric or hexadecimal).
.IP
145 146 147 148 149 150
.IP \fBrun\fR
Re-run the same process with the same arguments.
Note: all breakpoints of precedent process are no longer available.
.IP \fBrun\ \fIarg1\ arg2...\fR
Re-run the same process with arguments \fIarg1\ arg2...\fR.
Note: all breakpoints of precedent process are no longer available.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
.PP
\fIHelp commands\fR
.IP \fBhelp\fR
Prints some help on the commands.
.IP \fBhelp\ info\fR
Prints some help on info commands
.PP
\fIFlow control commands\fR
.IP \fBcont\fR
Continue execution until next breakpoint or exception.
.IP \fBpass\fR
Pass the exception event up to the filter chain.
.IP \fBstep\fR
Continue execution until next C line of code (enters function call)
.IP \fBnext\fR
Continue execution until next C line of code (doesn't enter function
call)
.IP \fBstepi\fR
Execute next assembly instruction (enters function call)
.IP \fBnexti\fR
Execute next assembly instruction (doesn't enter function call)
.IP \fBfinish\fR
173
Execute until return of current function is reached.
174 175 176 177 178 179
.PP
\fBcont\fR, \fBstep\fR, \fBnext\fR, \fBstepi\fR, \fBnexti\fR can be
postfixed by a number (N), meaning that the command must be executed N
times before control is returned to the user.
.PP
\fIBreakpoints, watchpoints
180 181 182 183 184 185 186 187 188 189 190
.IP \fBenable\ \fIN\fR
Enables (break|watch)-point \fIN\fR
.IP \fBdisable\ \fIN\fR
Disables (break|watch)-point \fIN\fR
.IP \fBdelete\ \fIN\fR
Deletes (break|watch)-point \fIN\fR
.IP \fBcond\ \fIN\fR
Removes any existing condition to (break|watch)-point \fIN\fR
.IP \fBcond\ \fIN\ expr\fR
Adds condition \fIexpr\fR to (break|watch)-point
\fIN\fR. \fIexpr\fR will be evaluated each time the
191 192
(break|watch)-point is hit. If the result is a zero value, the
breakpoint isn't triggered.
193 194 195 196 197 198 199 200
.IP \fBbreak\ *\ \fIN\fR
Adds a breakpoint at address \fIN\fR
.IP \fBbreak\ \fIid\fR
Adds a breakpoint at the address of symbol \fIid\fR
.IP \fBbreak\ \fIid\ N\fR
Adds a breakpoint at the line \fIN\fR inside symbol \fIid\fR.
.IP \fBbreak\ \fIN\fR
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 204 205
.IP \fBwatch\ *\ \fIN\fR
Adds a watch command (on write) at address \fIN\fR (on 4 bytes).
.IP \fBwatch\ \fIid\fR
206
Adds a watch command (on write) at the address of symbol
207 208 209 210
\fIid\fR. Size depends on size of \fIid\fR.
.IP \fBrwatch\ *\ \fIN\fR
Adds a watch command (on read) at address \fIN\fR (on 4 bytes).
.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 214 215 216 217
.IP \fBinfo\ break\fR
Lists all (break|watch)-points (with their state).
.PP
You can use the symbol \fBEntryPoint\fR to stand for the entry point of the Dll.
.PP
218
When setting a (break|watch)-point by \fIid\fR, if the symbol cannot
219 220 221 222 223 224 225
be found (for example, the symbol is contained in a not yet loaded
module), \fBwinedbg\fR will recall the name of the symbol and will try
to set the breakpoint each time a new module is loaded (until it succeeds). 
.PP
\fIStack manipulation\fR
.IP \fBbt\fR
Print calling stack of current thread.
226 227
.IP \fBbt\ \fIN\fR
Print calling stack of thread of ID \fIN\fR. Note: this doesn't change
228 229 230 231
the position of the current frame as manipulated by the \fBup\fR &
\fBdn\fR commands).
.IP \fBup\fR
Goes up one frame in current thread's stack
232 233
.IP \fBup\ \fIN\fR
Goes up \fIN\fR frames in current thread's stack
234 235
.IP \fBdn\fR
Goes down one frame in current thread's stack
236 237 238 239
.IP \fBdn\ \fIN\fR
Goes down \fIN\fR frames in current thread's stack
.IP \fBframe\ \fIN\fR
Sets \fIN\fR as the current frame for current thread's stack.
240 241 242 243 244
.IP \fBinfo\ locals\fR
Prints information on local variables for current function frame.
.PP
\fIDirectory & source file manipulation\fR
.IP \fBshow\ dir\fR
245 246 247
Prints the list of dirs where source files are looked for.
.IP \fBdir\ \fIpathname\fR
Adds \fIpathname\fR to the list of dirs where to look for source
248 249
files
.IP \fBdir\fR
250 251 252 253 254 255
Deletes the list of dirs where to look for source files
.IP \fBsymbolfile\ \fIpathname\fR
Loads external symbol definition file \fIpathname\fR
.IP \fBsymbolfile\ \fIpathname\ N\fR
Loads external symbol definition file \fIpathname\fR (applying
an offset of \fIN\fR to addresses)
256 257 258 259
.IP \fBlist\fR
Lists 10 source lines forwards from current position.
.IP \fBlist\ -\fR
Lists 10 source lines backwards from current position
260 261 262 263 264 265 266 267
.IP \fBlist\ \fIN\fR
Lists 10 source lines from line \fIN\fR in current file
.IP \fBlist\ \fIpathname\fB:\fIN\fR
Lists 10 source lines from line \fIN\fR in file \fIpathname\fR
.IP \fBlist\ \fIid\fR
Lists 10 source lines of function \fIid\fR
.IP \fBlist\ *\ \fIN\fR
Lists 10 source lines from address \fIN\fR
268 269 270 271 272 273
.PP
You can specify the end target (to change the 10 lines value) using
the ',' separator. For example:
.IP \fBlist\ 123,\ 234\fR
lists source lines from line 123 up to line 234 in current file
.IP \fBlist\ foo.c:1,56\fR
274
lists source lines from line 1 up to 56 in file foo.c
275 276 277 278
.PP
\fIDisplaying\fR
.PP
A display is an expression that's evaluated and printed after the
279
execution of any \fBwinedbg\fR command.
280 281 282
.IP \fBdisplay\fR
.IP \fBinfo\ display\fR
Lists the active displays
283 284 285 286 287
.IP \fBdisplay\ \fIexpr\fR
Adds a display for expression \fIexpr\fR
.IP \fBdisplay\ /\fIfmt\ \fIexpr\fR
Adds a display for expression \fIexpr\fR. Printing evaluated
\fIexpr\fR is done using the given format (see \fBprint\ command\fR
288
for more on formats)
289 290 291
.IP \fBdel\ display\ \fIN\fR
.IP \fBundisplay\ \fIN\fR
Deletes display \fIN\fR
292 293 294 295
.PP
\fIDisassembly\fR
.IP \fBdisas\fR
Disassemble from current position
296 297 298 299
.IP \fBdisas\ \fIexpr\fR
Disassemble from address \fIexpr\fR
.IP \fBdisas\ \fIexpr\fB,\fIexpr\fR
Disassembles code between addresses specified by the two expressions
300 301
.PP
\fIMemory\ (reading,\ writing,\ typing)\fR
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
.IP \fBx\ \fIexpr\fR
Examines memory at address \fIexpr\fR
.IP \fBx\ /\fIfmt\ expr\fR
Examines memory at address \fIexpr\fR using format \fIfmt\fR
.IP \fBprint\ \fIexpr\fR
Prints the value of \fIexpr\fR (possibly using its type)
.IP \fBprint\ /\fIfmt\ expr\fR
Prints the value of \fIexpr\fR (possibly using its type)
.IP \fBset\ \fIvar\fB\ =\ \fIexpr\fR
Writes the value of \fIexpr\fR in \fIvar\fR variable
.IP \fBwhatis\ \fIexpr\fR
Prints the C type of expression \fIexpr\fR
.PP
.IP \fIfmt\fR
is either \fIletter\fR or \fIcount letter\fR, where \fIletter\fR
317 318 319 320 321
can be:
.RS 4
.IP s
an ASCII string
.IP u
322
a UTF16 Unicode string
323 324 325
.IP i
instructions (disassemble)
.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 332 333
.IP c
character (only printable 0x20-0x7f are actually printed)
.IP b
334
8-bit unsigned hexadecimal integer
335 336 337 338 339 340 341 342 343 344 345
.IP g
Win32 GUID
.RE
.PP
\fIExpressions\fR
.PP
Expressions in Wine Debugger are mostly written in a C form. However,
there are a few discrepancies:
.PP
.RS 4
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.
347
.PP
348 349
In a cast operation, when specifying a structure or a union, you must
use the struct or union keyword (even if your program uses a typedef).
350 351
.RE
.PP
352
When specifying an identifier, if several symbols with
353 354 355
this name exist, the debugger will prompt for the symbol you want to
use. Pick up the one you want from its number.
.PP
356 357
\fIMisc.\fR
.PP
358
.BI "minidump " file.mdmp
359
saves the debugging context of the debuggee into a minidump file called 
360
\fIfile.mdmp\fR.
361
.PP
362
\fIInformation on Wine internals\fR
363
.IP \fBinfo\ class\fR
364 365 366
Lists all Windows classes registered in Wine
.IP \fBinfo\ class\ \fIid\fR
Prints information on Windows class \fIid\fR
367 368 369
.IP \fBinfo\ share\fR
Lists all the dynamic libraries loaded in the debugged program
(including .so files, NE and PE DLLs)
370 371
.IP \fBinfo\ share\ \fIN\fR
Prints information on module at address \fIN\fR
372 373
.IP \fBinfo\ regs\fR
Prints the value of the CPU registers
374 375
.IP \fBinfo\ all-regs\fR
Prints the value of the CPU and Floating Point registers
376 377
.IP \fBinfo\ segment\fR
Lists all allocated segments (i386 only)
378 379
.IP \fBinfo\ segment\ \fIN\fR
Prints information on segment \fIN\fR (i386 only)
380 381 382 383
.IP \fBinfo\ stack\fR
Prints the values on top of the stack
.IP \fBinfo\ map\fR
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
Jon Griffiths's avatar
Jon Griffiths committed
387
Displays the window hierarchy starting from the desktop window
388 389
.IP \fBinfo\ wnd\ \fIN\fR
Prints information of Window of handle \fIN\fR
390 391 392 393
.IP \fBinfo\ process\fR
Lists all w-processes in Wine session
.IP \fBinfo\ thread\fR
Lists all w-threads in Wine session
394 395 396 397
.IP \fBinfo\ frame\fR
Lists the exception frames (starting from current stack frame). You
can also pass, as optional argument, a thread id (instead of current
thread) to examine its exception frames.
398
.PP
399 400 401
Debug messages can be turned on and off as you are debugging using
the \fBset\fR command, but only for channels initialized with the
\fIWINEDEBUG\fR environment variable.
402 403 404 405 406 407
.IP \fBset\ warn\ +\ \fIwin\fR
Turns on warn on \fIwin\fR channel
.IP \fBset\ +\ \fIwin\fR
Turns on warn/fixme/err/trace on \fIwin\fR channel
.IP \fBset\ -\ \fIwin\fR
Turns off warn/fixme/err/trace on \fIwin\fR channel
408
.IP \fBset\ fixme\ -\ all\fR
409
Turns off fixme class on all channels
410 411 412 413 414
.PP
.SS Gdb mode:
.PP
See the \fBgdb\fR documentation for all the \fBgdb\fR commands.
.PP
415
However, a few Wine extensions are available, through the
416 417
\fBmonitor\fR command:
.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 423
Displays memory mapping of debugged process
.PP
424
.SS Auto and minidump modes:
425 426 427 428 429 430
.PP
Since no user input is possible, no commands are available.

.SH ENVIRONMENT
.IP \fBWINE_GDB\fR
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 433 434 435
is used by default.
.SH AUTHORS
The first version was written by Eric Youngdale.
.PP
436
See Wine developers list for the rest of contributors.
437 438
.SH BUGS
Bugs can be reported on the
439
.UR https://bugs.winehq.org
440 441 442 443 444 445
.B Wine bug tracker
.UE .
.SH AVAILABILITY
.B winedbg
is part of the Wine distribution, which is available through WineHQ,
the
446
.UR https://www.winehq.org/
447 448
.B Wine development headquarters
.UE .
449
.SH "SEE ALSO"
450 451
.BR wine (1),
.br
452
.UR https://www.winehq.org/help
453 454
.B Wine documentation and support
.UE .