Postmortem debugging under Windows
Written by P. Most   

It's surprising how many developers don't know how to enable and use postmortem debugging under Windows. Here is a step by step instruction.


Preparing the target system

  • If the Developer Studio is installed then switch of the "Just-in-time debugging" option under Tools > Options > Debug, otherwise the Visual Studio Debugger is invoked instead of Dr. Watson.
  • In the Dr. Watson GUI (drwtsn32.exe) enable all options except "Append To Existing Log File". From now on Dr. Watson writes a "Crash Dump File".

Dr. Watson

  • After a crash, backup the files "drwtsn32.log" and "user.dmp". If you can't find the files, then check the path in the Dr. Watson GUI.

Preparing the build process

  • For the "Release"-build, change these settings in the Developer Studio:
    - Set 'Project > Properties > C++ > General > Debug info' to 'Program Database'.
    - Enable 'Project > Settings > Link > General > Generate debug info'.
    - In the 'Project Options' add '/opt:ref,icf'.

WinDbg

  • Load the crash dump and try to find the error. Good Luck Wink



Update: A former colleague of mine (Stefan Dirrhammer) informed me that the current visual studio versions are already capable to read and use the crash dumps. Even the Express editions can use them:

Visual C++ 2010 Express

  When I wrote the original instructions, a couple of years ago for the Visual Studio 6.0, this wasn't possible. But this is even better because you don't have to install WinDbg Smile




Last Updated on Thursday, 01 July 2010 13:43
 

Add comment


Security code
Refresh

PERA Software Solutions GmbH, Powered by Joomla! and designed by SiteGround web hosting