I use WinDbg to parse crash reports from some windows app. I parse them using batch script.It works fine. Crash report is parsed by WinDBG and process terminate.
But there are some corrupted crash reports that cause WinDbg to show error dialog "failure when opening crash dump". That cause WinDBG to continue working and therefore batch script freezes. And I want to avoid this. I have used flags [-Q | -QY] [-QS | -QSY]. They do not suppress my error message. Can I parse my crash report in another way to avoid this problem?As Ryan Bemrose said, you're going to have a hard time getting anything useful out of a corrupt dump file. And, if you do succeed in opening it, you'll always be wondering if what you're looking at is part of the bug that triggered the dump or an artifact of the corrupt dump.
That said, if you are just trying to keep your automated script from choking on bad input, there is a tool that can help. DumpChk.exe
takes a dump file as input and tells you whether it is corrupt. You can script it by checking the errorlevel
after the call.
The script would look something like this:
dumpchk "%1"
if not errorlevel 1 (
windbg -z "%1" -c "your analysis script"
) else (
echo "Bad dump file: %1"
)
(Where %1 is the dump file.)
Also, you might take a look at cdb
instead of WinDbg. It uses the same backend as WinDbg but it's a bit friendlier to running on the command line.