Skip to content

Instantly share code, notes, and snippets.

@vchekan
Last active April 20, 2018 15:04
Show Gist options
  • Save vchekan/5513176 to your computer and use it in GitHub Desktop.
Save vchekan/5513176 to your computer and use it in GitHub Desktop.
Windbg for clr cheatsheet
### making a memory dump
adplus.exe -hang -iis -o c:\dumps
Symbol search path: srv*c:\symbols*http://msdl.microsoft.com/download/symbols
.loadby sos clr
!threads
!threadpool
~* e !clrstack ### show all clr stacks
.cls ### clear screen
Find all instances of type DefaultServerPool (substring matching)
!dumpheap -type DefaultServerPool
### heap investigation
!heapstat ### which heap (genX or LOH) consumes space
!dumpheap -stat ### which type takes memory
!dumpheap -stat -min 85000 ### which type takes memory in LOH
!dumpheap -mt 000007fef8f8adf8 -min 85000 ### get address of instances of a type
!gcroot 0000000167590068 ### who owns (and prevents GC-ing) given object
### foreach loop
.foreach ($addr {!dumpheap -short -mt 000007fef8faf650 }) {!do $addr}
# !do field at offset 0xNN
.foreach ($addr {!dumpheap -short -mt 000007fef8faf650 }) {!do poi(${$addr}+0x8)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment