Assume a remote site gets a rare error but doesn't crash the application. I would still like to create a mini dump file when this happens so I have some information to work with, mainly the call stack.
Pseudo code is following:
try
{
doStuff();
}
catch(_com_error &e)
{
make_minidump(); // is this possible?
dump_com_error(e);
return FALSE;
}
All the examples I see requires that I will have to cause the application to crash (for demo purpose at least) to produce dump file but I don't want to do that. Is it possible to create dump file like this?
I know I can go to task manager and create dump file of a running process and likewise I can use ProcessExplorer to achieve the same, so it seems like it should be possible.
At the same time in all examples I see, dump file is generated only when controls comes to SetUnhandledExceptionFilter which is called when an application crashes!
As a last resort, is the only way to get dump file generated is to deliberately crash the application with something like below: Will that produce anything useful beyond the crash? because I know what caused the crash in this case.
LONG CALLBACK unhandled_handler(EXCEPTION_POINTERS* e)
{
make_minidump(e);
return EXCEPTION_CONTINUE_SEARCH;
}
int main()
{
SetUnhandledExceptionFilter(unhandled_handler);
return *(int*)0;
}