예제 #1
0
LONG __stdcall exception_filter(EXCEPTION_POINTERS* exceptionPtrs)
{
    LONG returnCode = EXCEPTION_CONTINUE_SEARCH;
    
    // Ignore multiple calls.
    if (s_inFilter != 0)
        return EXCEPTION_CONTINUE_EXECUTION;
    s_inFilter = 1;
    
    // Cannot really do much in case of stack overflow, it'll probably bomb soon 
    // anyway.
    if (exceptionPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW)
    {
        OutputDebugString("*** FATAL ERROR: EXCEPTION_STACK_OVERFLOW detected!");
    }
    const bool miniDumpOK = WriteMiniDump(exceptionPtrs, s_miniDumpFileName);

    FILE* f = ::fopen(s_reportFileName, "wt");
    WriteHeader(f);
    WriteExceptionInfo(f, exceptionPtrs);
    WriteCallStack(f, exceptionPtrs->ContextRecord);

    WriteEnvironmentInfo(f);
    MemoryStatus memStatus = MemoryStatus::GetCurrent();
    WriteMemoryStatus(f, memStatus);
    WriteRegisters(f, exceptionPtrs);
    WriteBlackBoxMessages(f);

    fprintf(f, (miniDumpOK ? "\nMini dump saved successfully.\n" : "\nFailed to save minidump.\n"));
    ::fclose(f);

    return returnCode;
}
예제 #2
0
 /// writes exception report
 void WriteExceptionReport(
    const Debug::DebugeeInfo& debuggeeInfo,
    const Debug::ExceptionInfo& exceptionInfo,
    const std::multimap<DWORD, DWORD>& mmapChildProcesses,
    const std::vector<DebugEvent>& vecDebugEvents)
 {
    WriteExceptionInfo(exceptionInfo);
    WriteDebuggeeInfo(debuggeeInfo);
    WriteChildProcessMap(debuggeeInfo, mmapChildProcesses);
    WriteDebugEventList(vecDebugEvents);
 }