WinDBG

WinDBG is the best debugger available for Windows. It’s able to debug both user mode and kernel code. The preview version of WinDBG can be downloaded from the Microsoft store here.

The article contains a list of useful WinDBG commands.

General Commands

CommandDescription
.sympath [SymbolPath]Set or display the symbol search path.
.reloadReload symbol information.
.chainDisplay the current function call chain.
.clsClear the screen.
.restartRestart the target application or operating system.

Breakpoints

CommandDescription
bp [Address]Set a breakpoint at the specified address.
bu [Address]Set an unresolved breakpoint.
bc [BreakpointNumber]Clear a breakpoint.
blList all breakpoints.
bp <module>!<function>Break on a function call. E.g bp ws2_32!recv, bp Application!Main

Execution Control

CommandDescription
gGo (resume execution).
pStep into (execute one instruction and break).
tTrace (execute one instruction and continue).
ptTrace until the current function returns.
guGo until the specified address.

Registers & Memory

CommandDescription
rDisplay or modify register values.
dq [Address]Display quad-word (64 bits) memory at the specified address.
dd [Address]Display double-word (32 bits) memory at the specified address.
db [Address]Display byte memory at the specified address.
dq poi([Address])Derference memory at specified address.
u @ripDisplay next instructions to be executed.

Stack Commands

CommandDescription
kDisplay the call stack.
!tebDisplay information about the Thread Environment Block (TEB).

Module and Symbol Information

CommandDescription
lmList loaded modules.
x [Symbol]Examine symbols (display information about symbols).
!sym noisyEnable verbose symbol loading output.

Analysis

CommandDescription
!analyze -vAutomatically analyze the crash dump.
!threadDisplay information about the current thread.
!processDisplay information about the current process.
!addressCheck memory permissions.

Calling Conventions

x64 Function Calls

Parameter TypeARGOARG1ARG2ARG3
IntegerRCXRDXR8R9
Floating PointXMM0LXMM1LXMM2LXMM3L

x64 Syscall Calls

System Call NumberARG0ARG1ARG2ARG3
RAXR10RDXR8R9