Friday, October 12, 2007

Windows Crash Dump and Hang Analysis - BSOD keyboard shortcut

How to debug Windows crashes and hangs:

1) Configure Windows to take a complete memory dump, log the event and make sure it won't automatically restart in case of system failure (so you can see the BSOD).

2) Configure Windows to crash and memory dump on a hot key. In case Windows freezes, it may become necessary to force Windows to crash. Note: the hot key only works with a PS/2 keyboard, not USB, since it uses i8042prt driver that controls the keyboard and PS/2-compatible mouse for the Intel 8042 controller. The system may not respond to the shortcut in some scenarios.

Start regedit, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters and add a DWORD value called "CrashOnCtrlScroll" and give it a value other than 0 (like say, 1).

3) Reboot.

4) Wait for the system to hang.

5) Press and hold the _right_ Ctrl key and press ScrollLock twice to force the system to crash and take a memory dump. If you've done everything right, you should get a BSOD similar to this one (the one in the picture is a Windows 2003 R2 / SP2 BSOD):

Now you have a memory dump you can use to debug the system freeze.

If you want to see how to analyze an actual memory dump, see: Windows Crash Dump Analysis - Pinpointing Faulty Drivers with Driver Verifier and WinDbg -