Making it easier to debug .net dumps in windbg using .cmdtree
John Robbins beat me to the punch and wrote an excellent post about using .cmdtree
in windbg to ease some .net debugging pain in windbg.
Update 2021: I later found out the script originated with Roberto Farah so adding some credit to him as well
The windbg .cmdtree c:\path_to\my-cmdtree.txt
command allows you to create a popup window in windbg with commands that execute when you click on the respective link, so you no longer have to remember all the sos commands to get around in your managed dump.
The cmdtree.txt file used here looks like this:
windbg ANSI Command Tree 1.0
title {"Common Commands"}
body
{"Common Commands"}
{"Information"}
{"Time of dump"} {".time"}
{"Process being debugged"} {"|"}
{"Dump Location"} {"||"}
{"Create server on port 9999"} {".server tcp:port=9999"}
{"Show remote connections"} {".clients"}
{"Process Environment Block"} {"!peb"}
{"Logging"}
{"Open Log"} {".logopen /t /u /d"}
{"Close Log"} {".logclose"}
{"Modules"}
{"All Modules"} {"lm D sm"}
{"Loaded Modules"} {"lmo D sm"}
{"Loaded Modules (verbose)"} {"lmvo D sm"}
{"Modules w/o symbols"} {"lme D sm"}
{"Stacks"}
{"Set frame length to 2000"} {".kframes 2000"}
{"Dump current stack w/ DML"} {"kpM 1000"}
{"Dump stacks without private info"} {"knL 1000"}
{"Dump stacks with all parameters"} {"kPn 1000"}
{"Dump stacks (distance from last frame)"} {"kf 1000"}
{"Dump stacks with Frame Pointer Omission"} {"kvn 1000"}
{"Dump all stack"} {"~*kbn 1000"}
{"Dump unique stacks"} {"!uniqstack -pn"}
{"Thread environment block"} {"!teb"}
{"Move to next frame"} {".f+"}
{"Move to previous frame"} {".f-"}
{"Memory"}
{"Dump heaps"} {"!heap -a"}
{"Automated Task"}
{"!analyze"} {"!analyze -v"}
{"Locks"} {"!ntsdexts.locks"}
{"CPU time for User and Kernel Mode"} {"!runaway 7"}
{"Managed"}
{"Load sos"} {".loadby sos mscorwks"}
{"clrstack"} {"!clrstack"}
{"Threads"} {"!threads"}
{"Stack Objects"} {"!dso"}
{"Exceptions"} {"!dae"}
You can also add the command .cmdtree c:\path_to\cmdtree.txt
once you have this set up, to your commands file to get it loaded automatically when you open dumps. And of course, you can easily customize your command tree so that you can execute any commands you like.
The cmdtree.txt is available in the debugging scripts repo
Really sweet, Tess