1 minute read

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 favorite 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 right-clicking 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*http://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!