WINE_GDB
When used in gdb proxy mode, WINE_GDB specifies the name (and the path) of the executable to be used for gdb. "gdb" is used by default.
Wine's debugger
winedbg [options]
[{program
name
[program
arguments] | pid}]
winedbg --gdb
[options]
[{program
name
[program
arguments] | pid}]
winedbg --auto
pid
winedbg --minidump
[file.mdmp]
pid
winedbg file.mdmp
winedbg is a debugger for Wine. It allows:
+ debugging native Win32 applications + debugging Winelib applications. + being a drop-in replacement for Dr Watson
winedbg can be used in five modes. The first argument to the program determines the mode winedbg will run in.
defaultWithout any explicit mode, this is standard winedbg operating mode. winedbg will act as the front end for the user.
--gdbwinedbg will be used as a proxy for gdb. gdb will be the front end for command handling, and winedbg will proxy all debugging requests from gdb to the Win32 APIs.
--autoThis mode is used when winedbg is set up in AeDebug registry entry as the default debugger. winedbg will then display basic information about a crash. This is useful for users who don't want to debug a crash, but rather gather relevant information about the crash to be sent to developers.
--minidumpThis mode is similar to the --auto one, except that instead of printing the information on the screen (as --auto does), it's saved into a minidump file. The name of the file is either passed on the command line, or generated by WineDbg when none is given. This file could later on be reloaded into winedbg for further examination.
file.mdmpThis mode allows to reload into winedbg the state of a debuggee which has been saved into a minidump file. See either the minidump command below, or the --minidump mode.
When in default mode, the following options are available:
--command <string>
winedbg will execute the command <string> as if it was keyed on winedbg's command line, and then will exit. This can be handy for getting the pid of running processes (winedbg --command "info proc").
--file <filename>
winedbg will execute the list of commands contained in file <filename> as if they were keyed on winedbg's command line, and then will exit.
When in gdb proxy mode, the following options are available:
--no-start
gdb will not be automatically started. Relevant information for starting gdb are printed on screen. This is somehow useful when not directly using gdb but some graphical front-ends, like ddd or kgbd.
--with-xterm
This will run gdb in its own xterm instead of using the current Unix console for textual display.
In all modes, the rest of the command line, when passed, is used to identify which programs, if any, has to debugged:
This is the name of an executable to start for a debugging session. winedbg will actually create a process with this executable. If programs arguments are also given, they will be used as arguments for creating the process to be debugged.
pidwinedbg will attach to the process which pid is pid (pids refer to Win32 pids, not Unix pids). Use the info proc winedbg command to list running processes and their Win32 pids.
defaultIf nothing is specified, you will enter the debugger without any run nor attached process. You'll have to do the job yourself.
Most of commands used in winedbg are similar to the ones from gdb. Please refer to the gdb documentations for some more details. See the gdb differences section later on to get a list of variations from gdb commands.
Misc. commands
abortAborts the debugger.
quitExits the debugger.
Attach to a Wine-process (N is its ID, numeric or hexadecimal). IDs can be obtained using the info process command. Note the info process command returns hexadecimal values
detachDetach from a Wine-process.
Help commands
helpPrints some help on the commands.
Prints some help on info commands
Flow control commands
contContinue execution until next breakpoint or exception.
passPass the exception event up to the filter chain.
stepContinue execution until next C line of code (enters function call)
nextContinue execution until next C line of code (doesn't enter function call)
stepiExecute next assembly instruction (enters function call)
nextiExecute next assembly instruction (doesn't enter function call)
finishExecute until return of current function is reached.
cont, step, next, stepi, nexti can be postfixed by a number (N), meaning that the command must be executed N times before control is returned to the user.
Breakpoints, watchpoints
Enables (break|watch)-point #N
disableDisables (break|watch)-point #N
deleteDeletes (break|watch)-point #N
Removes any existing condition to (break|watch)-point N
Adds condition <expr> to (break|watch)-point #N. <expr> will be evaluated each time the (break|watch)-point is hit. If the result is a zero value, the breakpoint isn't triggered.
Adds a breakpoint at address N
Adds a breakpoint at the address of symbol <id>
Adds a breakpoint at the line N inside symbol <id>.
Adds a breakpoint at line N of current source file.
breakAdds a breakpoint at current PC address.
Adds a watch command (on write) at address N (on 4 bytes).
Adds a watch command (on write) at the address of symbol <id>. Size depends on size of <id>.
Adds a watch command (on read) at address N (on 4 bytes).
Adds a watch command (on read) at the address of symbol <id>. Size depends on size of <id>.
Lists all (break|watch)-points (with their state).
You can use the symbol EntryPoint to stand for the entry point of the Dll.
When setting a (break|watch)-point by <id>, if the symbol cannot be found (for example, the symbol is contained in a not yet loaded module), winedbg will recall the name of the symbol and will try to set the breakpoint each time a new module is loaded (until it succeeds).
Stack manipulation
btPrint calling stack of current thread.
Print calling stack of thread of ID N. Note: this doesn't change the position of the current frame as manipulated by the up & dn commands).
upGoes up one frame in current thread's stack
Goes up N frames in current thread's stack
dnGoes down one frame in current thread's stack
Goes down N frames in current thread's stack
Sets N as the current frame for current thread's stack.
Prints information on local variables for current function frame.
Directory & source file manipulation
Prints the list of dir:s where source files are looked for.
Adds <pathname> to the list of dir:s where to look for source files
dirDeletes the list of dir:s where to look for source files
Loads external symbol definition symbolfile <pathname>
Loads external symbol definition symbolfile <pathname> (applying an offset of N to addresses)
listLists 10 source lines forwards from current position.
Lists 10 source lines backwards from current position
Lists 10 source lines from line #N in current file
Lists 10 source lines from line #N in file <pathname>
Lists 10 source lines of function <id>
Lists 10 source lines from address N
You can specify the end target (to change the 10 lines value) using the ',' separator. For example:
lists source lines from line 123 up to line 234 in current file
lists source lines from line 1 up to 56 in file foo.c
Displaying
A display is an expression that's evaluated and printed after the execution of any winedbg's command.
displayLists the active displays
Adds a display for expression expr>
Adds a display for expression <expr>. Printing evaluated <expr> is done using the given format (see print command for more on formats)
Deletes display #N
Disassembly
disasDisassemble from current position
Disassemble from address <expr>
Disassembles code between addresses specified by the two <expr>:s
Memory (reading, writing, typing)
Examines memory at <expr> address
Examines memory at <expr> address using format /fmt
Prints the value of <expr> (possibly using its type)
Prints the value of <expr> (possibly using its type)
Writes the value of <expr> in <var> variable.
Prints the C type of expression <expr>
is either /<letter> or /<count><letter>. <letter> can be:
an ASCII string
a UTF16 Unicode string
instructions (disassemble)
32 bit unsigned hexadecimal integer
32 bit signed decimal integer
16 bit unsigned hexadecimal integer
character (only printable 0x20-0x7f are actually printed)
8 bit unsigned hexadecimal integer
Win32 GUID
Expressions
Expressions in Wine Debugger are mostly written in a C form. However, there are a few discrepancies:
Identifiers can take a '!' in their names. This allows mainly to specify a module where to look the module from: USER32!CreateWindowExA.
In cast operation, when specifying a structure or an union, you must use the struct or union key word (even if your program uses a typedef).
When specifying an identifier <id>, if several symbols with this name exist, the debugger will prompt for the symbol you want to use. Pick up the one you want from its number.
Misc.
saves the debugging context of the debuggee into a minidump file called file.mdmp
Information on Wine's internals
Lists all Windows' class registered in Wine
Prints information on Windows's class <id>
Lists all the dynamic libraries loaded in the debugged program (including .so files, NE and PE DLLs)
Prints information on module at address N
Prints the value of the CPU registers
Prints the value of the CPU and Floating Point registers
Lists all allocated segments (i386 only)
Prints information on segment N (i386 only)
Prints the values on top of the stack
Lists all virtual mappings used by the debugged program
Lists all virtual mappings used by the program of pid N
Displays the window hierarchy starting from the desktop window
Prints information of Window of handle N
Lists all w-processes in Wine session
Lists all w-threads in Wine session
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.
Debug messages can be turned on and off as you are debugging using the set command, but only for channels initialized with the WINEDEBUG environment variable.
Turns on warn on 'win' channel
Turns on warn/fixme/err/trace on 'win' channel
Turns off warn/fixme/err/trace on 'win' channel
Turns off the 'fixme' class on all channels
See the gdb documentation for all the gdb commands.
However, a few Wine's extension are available, through the monitor command:
Lists all window in the Wine session
Lists all processes in the Wine session
Displays memory mapping of debugged process
Since no user input is possible, no commands are available.
WINE_GDB
When used in gdb proxy mode, WINE_GDB specifies the name (and the path) of the executable to be used for gdb. "gdb" is used by default.
No specific files are used (yet).