Condividi tramite


Associating WinDbg with .DMP files and other tips.

During a discussion here about debugging in Windows we got onto the topic of extensions and tricks to speed things up and cut out extra steps.

One super simple tip is to associate the .DMP memory dump files with WinDbg, this was previously posted by another Escalation Engineer who herself got it from someone else. Suffices to say that it's definitely worth passing along and can save a lot of time when going through many dumps:
https://blogs.msdn.com/tess/archive/2005/12/05/associate-windbg-with-dmp-files.aspx

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:\symbols*https://msdl.microsoft.com/download/symbols
.load clr10\sos

Here are some additional resources to help get you started in your debugging adventures. It should be noted that whether you're an OEM working on a case with our team or you're an average beta tester. Providing memory dumps and the most basic analysis initially will definitely help get the ball rolling, any support professional or tester will greatly appreciate the extra effort.

WinDbg Tutorial: https://www.codeproject.com/KB/debug/windbg_part1.aspx
Microsoft Advanced Windows Debugging and Troubleshooting
The Old New Thing
Windbg by Volker von Einem
Joel on Software
Debugging Toolbox
Advanced .NET Debugging