Rajinder Yadav - C++ Windows Development Tools & Resources :Design, Code, Test, Debug

Page 1 Page 2 Page 3 Page 4 Home

Generating a dump file - Page 3

Let's build and run our Crasher application that was designed to perform a zero division! (See attached project file). When the application crashes you will see the following dialog box. Simple click on "Don't Send".

At this point 2 files should have been created in our "crash_dump" folder.
We are interested in the dump file (.dmp).

Analysing the dump file

We need to open the crash dump file "user.dmp" as a "Project/Solution" from Visual Studio.

From the Project Dialog, go to the folder "c:\crash_dump"

Select "user.dmp" and hit the "Open" button.

You should see the following in your "Solution Explorer"

We need to tell Visual Studio where to find the symbol file(s). To do this, from the menu-bar select "Options..." under the "Tools" menu.

Go to the "Debugging" section and select "Symbols".

You will then have to type in the location of the symbol file(s) for the executable that causes the crash.

Now all we need to do is start debugging. This will give us the call stack and location of the crash in the source file!

NOTE: When a program is built and release to the general public, you will need to save the source files along with the symbols files at the time of the build. If you're using a source control like "CVS" just make sure to set the tag so you can easily fetch the old source code as it existed when the situation calls for it. The easy thing to do is just compress the source code along with the symbols files and store them in a safe place.

From the Debug menu select "Start Debugging" or simply hit the [F5] key.

If you did not follow the steps above and correctly point to the symbol fils, the following error message box will get displayed.

If everything was set properly, a dialog box will open asking you to locate the source files for the executable, once this is done you should immediately see a crash dialog box.

Just click on "Break" to view the crash location from the Visual Studio Debugger.

For our Crasher demo, we can see where the bug is, at line 11 there is a "Zero Division" error.

Now if you're one of those folks that uses WinDbg for all your debugging, then the process is similar. You can access the following options from the file menu.

Page 1 Page 2 Page 3 Page 4 Home

Rajinder Yadav Copyright (c) 2007