Common commands
- .open -a [symbol address or complete symbol name found by using x]
- Opens the source file containing the specified symbol. Pretty neat.
- k
- Displays the stack.
- kP: Show all parameters.
- kM: Show links to each stack frame.
- Clicking on the links shifts into the other stack frame, allowing you to browse locals, etc.
- ?? [data name]
- Quick evaluation of a C++ symbol (local variable, etc). You don't need to specify this-> for member variables but it's slower if you don't.
- dd address
- Displays the contents of memory at the given address (as doubles... dc, dw, dq etc)
- dt -r1 type address
- Displays an object of the given type stored at the given address, using 1 level of recursion.
- uf symbol
- Disassembles a function showing source line number.
- !stl
- Displays some stl structures (visualizer)
- dt -n <type>
- Displays a type forcing the name to the supplied type (when there are problematic characters in the name)
- Ctrl-Shift-I
- Sets the selected source line to be the next line to be executed
- F5, Ctrl-Shift-F5, F9, F10, F11
- Run, restart, toggle breakpoint, step over, step into.
One of the major benefits of WinDBG for debugging Chromium is its ability to automatically debug child processes. This allows you to skip all the complicated instructions above. The easiest way to enable this is to check "
Debug child processes also" in the "
Open Executable" dialog box when you start debugging or start "
windbg.exe -o".
NOTE that on 64-bit Windows you may need to use the 64-bit WinDbg for this to work. You can switch dynamically the setting on and off at will with the
.childdbg 1|0 command, to follow a particular renderer creation. You can also attach to a running process (
F6) and even detach without crashing the process (
.detach)
Common commands when working with a crash
- !analyze -v
- Displays a basic crash analysis report.
- .ecxr
- Switch the context to the exception record.
- dds address
- Displays symbols following address (as in a stack or vtable)
- k = address address address
- Rebuilds a call stack assuming that address is a valid stack frame.
- lm vmchr*
- Lists verbose information about all modules with a name that starts with ch
- ln address
- Lists all symbols that match a given address (dedups a symbol).
- .load wow64exts
- On a 64-bit debugger, load the 32-bit extensions so that the current architecture can be switched
- .effmach x86
- Switches the current architecture to 32-bit.
- .effmach x86; k = @ebp @ebp @ebp
- Shows the 32-bit call stack from a 64-bit dump
To set attach to child processes, and also skip the first breakpoint and the extra breakpoint on process exit (this gives you a pretty responsive Chrome you can debug):
sxn ibp
sxn epr
.childdbg 1
g
You can also get this effect by using the -g -G -o options when launching windbg, as in:
windbg -g -G -o chrome.exe
To automatically attach to processes you want to run over and over with complex command lines, just attach WinDBG to your command prompt and then
.childdbg 1 the command prompt - any processes launched from there will automatically be debugged. H/T pennymac@
To set a breakpoint in the current process you can use this module/function syntax, among others:
bp msvcrt!invalid_parameter
To apply this to future processes that are created (assuming child process debugging is enabled) you can use this syntax, which says to run the bp command whenever a new process is created:
sxe -c "bp msvcrt!invalid_parameter" cpr
If you want a chance to do this when you first launch the browser process then you need to launch it without -g (so that the first breakpoint will be hit). You will probably then want to disable the "Create process" breakpoint and "Initial breakpoint" with these commands:
sxn ibp; sxn epr;
These are equivalent to going to Debug-> Event Filters and setting "Create process" and "Initial breakpoint" to "Ignore".
Always use
--user-data-dir when starting Chrome built with
branding=Chrome or else you're going to have a bad time.
Resources