Windbg can be downloaded from the Microsoft store : Widbg download link

Commands and Shortcut Keys:

Note

The debugger injects a software breakpoint by overwriting the current instruction in memory with an INT 3 assembly instruction.

Caution

Terminating the debugger will also kill the attached process. This will require restarting the application either through the executable or, if it is a running service, through the services application.

Note

One of the advantages of WinDbg is the ability to use Microsoft symbols for core modules (DLLs).

TaskSKCommandexample
Attach a processF6--
continue execution-g-
break executionalt + del--
disassemble function-uu <ADDR>
display bytes-dbdb eip
display words-dwdw eip
words with ascii-dWdW eip
display double words-dddd eip
Double word with ascii-dcdc eip
display quadruple words-dqdq eip
display ascii-dada esp
display unicode-dudu esp
Length of data-Ldb eip L1
dereference a pointer’s data-poidb poi(eip)
display a structure-dtdt ntdll!_PEB
display structure using pseudo registers--dt -r ntdll!_TEB @$teb
display a particular part of structure--dt ntdll!_TEB @$teb ThreadLocalStoragePointer
size of a structure-sizeof?? sizeof(ntdll!_TEB)
edit ascii-eaea esp "pokemon"
edit value-eded esp 9878987
searching for a value-ss -d 0 L?8000000 4144141
searching for ascii-ss -a 0 L?8000000 "pokemon"
inspect registers value-r-
modify value of a register-rr rcx 7473875893
add a software breakpoint-bpbp kernel32!writefile
list breakpoints-bl-
disbale breakpoint-bdbd 0
enable breakpoint-bebe 0
clear breakpoint-bcbc * // clear all breakpoints
set unresolved breakpoint-bubu ole32!WriteStringStream
search for a particular match in loaded modules-lmlm m *module*
ignore exception-sxisxi eh
breakpoint actions--bp ... ".printf \" pokemon \" "
breakpoint conditional action--bp ... ".if (poi(esp + 0x0c) != 4 ) {gc} .else {.printf \" lol \" ;r;} "

Note

To perform a search we need s and four additional parameters:

  • the memory type to search for
  • the starting point of memory to search
  • the length of memory to search
  • the pattern to search for

Breakpoints two types :

  • Hardware [ba]
  • software [bp]

Breakpoints controlled directly by the debugger are known as software breakpoints. Breakpoints controlled by the processor and set through the debugger are known as hardware breakpoints.