If broken it is, fix it you should

Using the powers of the debugger to solve the problems of the world - and a bag of chips    by Tess Ferrandez, ASP.NET Escalation Engineer (Microsoft)

Associate windbg with .dmp files

Associate windbg with .dmp files

Rate This
  • Comments 17

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*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:)  

 





  • 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_ROOT\Debugger.Dump]

    [HKEY_CLASSES_ROOT\Debugger.Dump\DefaultIcon]
    @="c:\\debuggers\\cbd.exe"

    [HKEY_CLASSES_ROOT\Debugger.Dump\Shell]

    [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_Dump]
    @="Debug This Dump"

    [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_Dump\Command]
    @=\"C:\\Program Files\\Debugging Tools for Windows\\windbg\" -z \"%1\" -c \"$<C:\\Program Files\\Debugging Tools for Windows\\commands.txt\"
  • great, cbd.exe should be corrected as cdb.exe else the icon will be missing...
  • Sorry about the typo:) it's corrected now...
  • Didn't work on my machine :-(

    However this modification did do the trick

    [HKEY_CLASSES_ROOT\Applications\windbg.exe\shell\open\command]
    @="\"D:\\Program Files\\Debugging Tools for Windows\\windbg.exe\" -z \"%1\""

    I just had to add "-z"

    Tal.
  • If you just want to associate dump files with windbg but don't want to load any extensions automatically, or prefer to do that separately, you can run "windbg -IA" from the command line (if anyones interested).
  • PingBack from http://www.brianlow.com/index.php/2007/01/19/clr-debugging/

  • If you're like me and most of my colleagues in Customer Service and Support, you'll probably spend a

  • During a discussion here about debugging in Windows we got onto the topic of extensions and tricks to

  • Whenever I open a crash dump, I get a syntax error. When I execute the .cmdtree manually it works. Any ideas?

    Processing initial command '$<c:\dump\commands.txt'

    0:000> $<c:\dump\commands.txt

    0:000> .cmdtree c:\dump\tree.txt

        ^ Syntax error in '.cmdtree c:\dump\tree.txt'

  • 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 script

  • Did this issue ever get sorted out?  I am struggling with it now.   I can't seem to get a commands file to process the .cmdtree command at all.   If I type the same line in windbg, it works fine.  

  • 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 :(

  • hmmmmmmmm.........annoying.... oh well.

  • 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)

  • PJ, Thanks for this...

    I have been looking for a way to get it to dock automatically too but havent been able to so far

Page 1 of 2 (17 items) 12
Leave a Comment
  • Please add 4 and 7 and type the answer here:
  • Post