Associate windbg with .dmp files
If you get tired of starting the debugger, loading your dump, setting up your sympath, loading your extensions, etc. etc. here is a nifty way of getting "Debug this dump" on the context menu for .dmp files and get all your favourite commands automatically loaded.
First create a .reg file with the following contents (as always be very careful when modifying the registry)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.dmp]
@="Debugger.Dump"
[HKEY_CLASSES_ROOT\Debugger.Dump]
[HKEY_CLASSES_ROOT\Debugger.Dump\DefaultIcon]
@="c:\\debuggers\\cdb.exe"
[HKEY_CLASSES_ROOT\Debugger.Dump\Shell]
[HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_Without_Remote]
@="Debug This Dump"
[HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_Without_Remote\Command]
@="\"C:\\debuggers\\windbg\" -z \"%1\" -c \"$<c:\\debuggers\\commands.txt\""
[HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_With_Remote70]
@="Debug this Dump With Remote:70"
[HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_With_Remote70\Command]
@="\"C:\\debuggers\\windbg\" -server tcp:port=70 -z \"%1\" -c \"$<c:\\debuggers\\commands.txt\""
This will give you two additional options on the context menu when rightclicking on .dmp files. First "Debug this dump" which will open windbg with your dump and then run the commands in commands.txt. The second option "Debug this Dump With Remote:70" will do the same thing but also set up a remote so that your coworkers can remote in to your debugging session though port 70. (Remember to change the paths so they point to the directories where you have windbg.exe and commands.txt)
Secondly, create a file called commands.txt that contains any commands you want to run when the debugger starts. The one below sets the symbol path to the public symbols and loads sos.dll.
.sympath srv*c:\websymbols*https://msdl.microsoft.com/download/symbols
.load clr10\sos
I stole this reg file from a colleague of mine, but can't remember who, so unfortunately i can't give the proper person the credits, but whoever it was, thank you:)
Comments
Anonymous
December 05, 2005
Incredibly useful!
I have windbg installed in my 'progam files' so the above regedit script didn't work. Regardless though, this is an excellent timesaver for when using windbg.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT.dmp]
@="Debugger.Dump"
[HKEY_CLASSES_ROOTDebugger.Dump]
[HKEY_CLASSES_ROOTDebugger.DumpDefaultIcon]
@="c:\debuggers\cbd.exe"
[HKEY_CLASSES_ROOTDebugger.DumpShell]
[HKEY_CLASSES_ROOTDebugger.DumpShellDebug_Dump]
@="Debug This Dump"
[HKEY_CLASSES_ROOTDebugger.DumpShellDebug_DumpCommand]
@="C:\Program Files\Debugging Tools for Windows\windbg" -z "%1" -c "$<C:\Program Files\Debugging Tools for Windows\commands.txt"Anonymous
January 02, 2006
great, cbd.exe should be corrected as cdb.exe else the icon will be missing...Anonymous
January 02, 2006
Sorry about the typo:) it's corrected now...Anonymous
January 24, 2006
Didn't work on my machine :-(
However this modification did do the trick
[HKEY_CLASSES_ROOTApplicationswindbg.exeshellopencommand]
@=""D:\Program Files\Debugging Tools for Windows\windbg.exe" -z "%1""
I just had to add "-z"
Tal.Anonymous
March 22, 2006
The comment has been removedAnonymous
January 19, 2007
PingBack from http://www.brianlow.com/index.php/2007/01/19/clr-debugging/Anonymous
October 14, 2007
If you're like me and most of my colleagues in Customer Service and Support, you'll probably spend aAnonymous
August 30, 2008
The comment has been removedAnonymous
November 15, 2009
The comment has been removedAnonymous
November 16, 2009
thomas, only thing i can think of is some weird character either in between .cmdtree and the path, or in the tree.txt file itself... I dont see why that command shouldnt work in a commands scriptAnonymous
March 26, 2010
The comment has been removedAnonymous
March 28, 2010
PJ, i never had that issue, so unfortunately i dont know what the issue could be... still works for me in all versions of the debuggers that i've tried... I know that that wont help you much though :(Anonymous
March 28, 2010
hmmmmmmmm.........annoying.... oh well.Anonymous
April 15, 2010
I started doing this: -c ".cmdtree c:mycmdtree.txt" Rather than a commands file. That at least opens my cmdtree automatically. But any idea how to get it to dock? I read your post on themes for WinDbg, but I can't figure out how to get a commands window to dock in the BASE theme. (cause you need to open a DMP file before you do a command, but then you 'exit' the base theme)Anonymous
April 15, 2010
PJ, Thanks for this... I have been looking for a way to get it to dock automatically too but havent been able to so farAnonymous
April 15, 2010
The comment has been removedAnonymous
June 21, 2011
I associated dmp file to windbg from the open with list before reading this, how to get it back to original blank file with no autofile for win7?