I'm trying to create a dmp file that will match the Visual Studio debugger
"Save dump as" option.
I've managed to load MINIDUMPWRITEDUMP function from dbghelp.dll and to
create dmp file upon exception using the following call:
pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal,
&ExInfo, NULL, NULL );
But when trying to create a dmp file when no exception occurs (ExInfo is
NULL),
the dmp file created has no call stack information:
pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile,
MiniDumpWithDataSegs, NULL, NULL, NULL );
Any idea?
Thanks,
Eynav.
You can simulate an exception and get the exception context.
Something like this:
void MakeDump()
{
__try
{
// raise any kind of exception here
}
__except( WriteDump( GetExceptionInformation() ) )
{
}
}
LONG __stdcall WriteDump( EXCEPTION_POINTERS* pep )
{
// Call MiniDumpWriteDump here, pass "pep" to it
return EXCEPTION_EXECUTE_HANDLER;
}
Call MakeDump when you need a dump without exception context.
Then all stack frames above MakeDump will be visible.
Regards,
Oleg
Lots of thanks. I've raised an EXCEPTION_BREAKPOINT and it does lead to a
fully detailed call stack!
(havent used __stdcall in WriteDump function declaration but it looks ok as
is).
Great!
One more thing I'm wondering about is why call to
SetUnhandledExceptionFilter(Handler) doesnt seem to 'work',
i.e an unhandled exception is not caught by handler set!
I have a Com application (i.e C++ code operated by a web site).
When using same code on a regular exe application it works ok.
Any idea?
Thanks again,
eynav.
"Oleg Starodumov" <com-dot-debuginfo-at-oleg> wrote in message
news:OgqADSU0...@tk2msftngp13.phx.gbl...
If the COM server's method is called via proxy/stub, and there is an unhandled
exception in the method, the stub will handle the exception and return an error code
to the caller.
There is a way to disable this behavior (e.g. to verify whether it is the case or not):
http://support.microsoft.com/default.aspx?scid=kb;en-us;198623
(note: system restart is required after changing the Registry, and the KB article also applies
to XP even though it is not mentioned in the list of operating systems there)
Regards,
Oleg