Defrag Tools: #13 - WinDbg

Play Defrag Tools: #13 - WinDbg
Sign in to queue


In this episode of Defrag Tools, Andrew Richards and Larry Larsen start walking you through the Debugging Tools for Windows (in particular WinDbg). WinDbg is a debugger that supports user mode debugging of a process, or kernel mode debugging of a computer.

This first WinDbg installment configures the system to open dumps files via an adjusted Context Menu. It shows how to set WinDbg as the (AeDebug) postmortem debugger, and how to use ProcDump v5.1 to do the same but capture the process as a dump file. It then starts to explain some basic concepts of debugging: call stacks (k), registers (r) and exception context records (.ecxr).

Make sure you watch Defrag Tools Episode #1 for instructions on how to get the Debugging Tools for Windows and how to set the required environment variables for symbols and source code resolution.

Microsoft Windows SDK for Windows 7 and .NET Framework 4
Sysinternals ProcDump

[00:00] - Windows 8 General Availability (GA)
[02:45] - WinDbg -IA - Register File Associations
[05:45] - Custom Context Menu
[10:15] - WinDbg -I - Register Postmortem Debugger

[11:07] - Custom AeDebug: -c ".jdinfo %p"
[15:00] - ProcDump v5.1: -i <folder>
[18:00] - Internals of Windows Error Reporting
[21:48] - Registers (r)
[29:50] - Exception Context Record (.ecxr)
[32:01] - Examples - NT Debugging Blog
[34:02] - MSJ Magazine - Under The Hood
[35:20] - Intel Developer's Manual
[38:40] - Next week, Call Stacks, Locals and .NET/Silverlight extensions

MSJ (MSDN) Magazine:

Assembly Language

NT Debugging Blog:

Debugging Techniques



Custom Context Menu (WinDbg -IA):

Windows Registry Editor Version 5.00
@="WinDbg Post-Mortem Dump File"
@="Open x&64"
@="\"C:\\debuggers\\windbg.exe\" -z \"%1\" -c \".prefer_dml 1\""
@="Open x&86"
@="\"C:\\debuggers_x86\\windbg.exe\" -z \"%1\" -c \".prefer_dml 1\""

Custom AeDebug (WinDbg -I):

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Debugger"="\"C:\\debuggers\\windbg.exe\" -p %ld -e %ld -c \".jdinfo %p\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Debugger"="\"C:\\debuggers_x86\\windbg.exe\" -p %ld -e %ld -c \".jdinfo %p\""



Right click to download this episode

The Discussion

  • User profile image

    [05:45] - Custom Context Menu

    you should use this cool tool:" alt="Generic Comment Image">

    I never understood why you removed this functionality in Vista.

    [15:00] - ProcDump v5.1: -i <folder>

    Procdump 5.1 is still not out


  • User profile image

    !analyze -v (I might as well have this tattooed on by arm... Timely. I've been using WinDbg several hours a day for the past several weeks...)


  • User profile image

    @Magic: ProcDump v5.1 -- nearly there. It's going through the final phases to get published externally. Hopefully this week.

    @Charles!analyze -v is covered in Episode #15 (Kernel Analysis), and will get mentioned again in Episode #17 (User Analysis).

  • User profile image

    Hi Andrew, your're doing a fantastic job in this Defrag Tools series. I just find your delivery is too fast at times (I'm French) and I often miss bits. If you could slow down a bit ... :-) You're followed worldwide !

    Looking forward to next episode.


  • User profile image

    Finally something worth watching on c9. Been waiting for up to date debugger videos for ages.
    I'm also waiting on real kernel programming and c++11 videos. *Hint hint*

    Andrew Richards, yes please do go on. If you would make a video series of windbg and debugging techniques that are 40 hours per week, i would watch it.

    I'm saying the content demand for this stuff is pretty high.

    Just one note about reducing the 40 hour subject into 40 minutes. Please do not dumb it down. We are not idiots or children.
    The more detailed explanation the better. Do not jump over things because they are "too technical".

    This stuff is not hard. Memory intensive, yes but not mentally hard.

    Would be fun to hear how you would debug a multi-process crash. When i say multi-process i mean a program like Chrome.

    The debug tools are lacking when it comes to such crashes. Debugging tools always seem to be a few steps behind which in these modern days are quite frankly unacceptable. Like the non-optional metro ui for desktop computers or the locked in "secure boot" on x64 among other things W8.

    Hope to see you in many, many more videos ;)

  • User profile image

    @James: we have 5 in the bag and still at least 3 more to tape to just cover the basics. I expect another 5-10 after that on advanced stuff.

    The main issue with reducing the courses down to a show format is the inability to interact with the students. When we get in to some particular concepts (breakpoints come to mind), we'll provide examples that you can (and should) repeat at home - as showing it once won't suffice.

    The other struggle for Chad and I is doing all of the debugging with public symbols and extensions - we have internal tools that rely on private symbols that get us to root cause within seconds (this is how OCA and WER scale). Its a training exercise for us too to do it the public way!

    Next week is loading SOS, then there are 2 on kernel, then 3 on useful commands. Well then go on to scenario based episodes using advanced techniques.

    Multi-process - will be sure to cover that .. It's not too hard if you use the right tool.

    The content is hard - yep wrong word - it is just information overload as you say - and we plan to keep it that way abd never miss a deep dive in to a concept.

    Once all this is done, we'll cover xperf - which is debatable more powerful than the debugger.


    Thanks for watching.

  • User profile image
  • User profile image

    @felix9: The Defrag Tools series arose as a spinoff of Defrag Show so that troubleshooting tools in general could be covered at depth. We did a lot of research in the forums and this was one of the posts we paid a lot of attention to. Golnaz (our great studio operator) organized Brad to tackle the managed code aspect of windbg in his series ( - while we were planning Defrag Tools.

    On Defrag Tools, we're being more generic than Brad's series and are talking about the basic commands and the underlying OS constructs you need to know about. We'll defer to Brad's series for specific (deep) managed code debugging tips. We will and do cover the basics (next week is all about getting SOS loaded - for example) of managed debugging.

    This is a show for you - steer us in the direction you want us to go... If you want more than 10 episodes on WinDbg, tell us that and we'll hold off transitioning to xperf and will keep on producing windbg content for you. Chad and I both train the user and kernel mode courses within Microsoft and can easily continue to dive deeper and wider - from the physical hardware, up through kernel mode, through user mode and up in to high constructs like managed and WinRT application code.

  • User profile image

    Can Windbg be used with windows 8 store apps ? Does the debugger suspend interact with the app lifecycle management ?

  • User profile image

    , phb3 wrote

    Can Windbg be used with windows 8 store apps ? Does the debugger suspend interact with the app lifecycle management ?


    Was the debugger installation instructions from episode #1 ever updated for Win8?

    Windbg is supposed to be integrated into Visual Studio 2012 now but I don't see it anywhere?

    I had to install Window 8 Driver SDK for windbg x64 and x32 to show up.

    Might also be included with Windows 8 SDK download.


  • User profile image

    , phb3 wrote

    Can Windbg be used with windows 8 store apps ? Does the debugger suspend interact with the app lifecycle management ?


    Launching Windows Store App under a Debugger

Add Your 2 Cents