Example Code

LabWindows/CVI Tip: Generating a Crash Dump

Generating a Crash Dump

Every now and then, CVI users report a crash in the CVI environment, or in a CVI program that can't be explained by what the program is doing. If this crash can't be reproduced reliably, it's usually very hard for us here at NI to investigate the root cause of it. When that happens, a useful thing to do is to generate a crash dump and attach it to your bug report. The thing to keep in mind is that you have to suspect that a crash might be coming at some undetermined time in the future and enable the Windows debugger for dump generation before the crash happens. Here's how you can have Windows create a crash dump:

Windows XP

1. Run c:\windows\system32\drwtsn32.exe -i (this will register Dr. Watson as your "just in time" debugger)

2. Whenever you get a crash and you see the "Please tell Microsoft about this problem..." dialog, click "Don't Send".

3. Browse to the C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson folder. The dump and log files are there. Keep in mind that if you have a second crash, it should overwrite the previous dump.

Windows Vista

Dr. Watson is not available in Vista, and its replacement (Windows Error Reporting) is very flaky, when it comes to generating crash dumps. So your best bet is to use windbg.

1. Install the Windows debugging tools.

2. Run C:\Program Files\Debugging Tools for Windows\windbg.exe -I (this will register windbg as your "just in time" debugger)

3. When you get a crash, windbg should start up automatically. At that point, in to its command window type .dump /ma c:\temp\mydump.dmp to generate the dump file.

Note that this is still not as useful as specific instructions for reproducing the crash, but if that isn't possible, then this is definitely worthwhile.

Submitted by Luis G

Original forum post: http://forums.ni.com/ni/board/message?board.id=180&message.id=33860#M33860

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors