Wednesday, September 28, 2016

Windbg .net debugging most used commands

ctrl+D
load the dump file

k
check file

~* kb 2000
examine native callstacks

version
check versions of the dlls

.load sos
required for .net (extension)

.unload
to unload unwanted versions

.load sosex
loads the extended sos commands

~
list of threads

~* e !clrstack
gets all clrstacks of all threads to understand which one is managed

~49s
switchs to thread 49

!clrstack -p
analyze the current thread with parameters

!do 039ec48c
details on instance 039ec48c

kb 2000
show the current thread call stack without managed code

!syncblk
Shows which thread owns the lock
Index SyncBlock MonitorHeld Recursion Owning Thread Info  SyncBlock Owner
   97 000000a76acc6f08            3         1 000000a76ca31660 3b0  52   000000a7005d1a18 System.Object
  418 000000a76b2463a8            1         1 000000a76ca894f0 238c  37   000000a702f6f2f8 ASP.global_asax
MonitorHeld=3 is the threads waiting

!dlk
examines the deadlocks

!mlocks

!dso
show instances in thread

!mdso
objects in different view (with links)

!do 039ec48c
details on instance 039ec48c

!mk
Produces and displays a merged stack trace of managed and unmanaged frames.

!address -summary
show summary of mem

!eeheap -gc
get managed heap size

!dumpheap -stat
objects and sizes in heap

!refs 000000a705314c38
shows all references to the object

!mwaits
show all waiting threads

!strings
shows all strings in dump (might take very long)