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; }
void InterpreterDisAsmFrame::DoUpdate() { wxCommandEvent ce; Show_PC(ce); WriteRegs(); WriteCallStack(); }
void DebugInfoXmlWriter::WriteExceptionInfo(const Debug::ExceptionInfo& exceptionInfo) { m_spWriter->WriteStartElement(_T("exception-info")); CString cszText; cszText.Format(_T("0x%08x"), exceptionInfo.ProcessId()); m_spWriter->WriteAttributeString(_T("process-id"), cszText); cszText.Format(_T("0x%08x"), exceptionInfo.ThreadId()); m_spWriter->WriteAttributeString(_T("thread-id"), cszText); cszText.Format(_T("0x%08x"), exceptionInfo.ExceptionCode()); m_spWriter->WriteAttributeString(_T("exception-code"), cszText); cszText.Format(_T("0x%p"), exceptionInfo.ExceptionAddress()); m_spWriter->WriteAttributeString(_T("exception-address"), cszText); m_spWriter->WriteAttributeString(_T("type"), exceptionInfo.IsFirstChance() ? _T("1st-chance") : _T("2nd-chance")); m_spWriter->WriteStartElementEnd(); { m_spWriter->WriteStartElement(_T("exception-numbers")); m_spWriter->WriteStartElementEnd(); const std::vector<ULONG_PTR>& vecNumbers = exceptionInfo.ExceptionInformation(); CString cszNumber; for (size_t i=0, iMax=vecNumbers.size(); i<iMax; i++) { cszNumber.Format(_T("0x%lx"), vecNumbers[i]); m_spWriter->WriteElementString(_T("number"), cszNumber); } m_spWriter->WriteEndElement(); } // callstack const Debug::CallStack& callstack = exceptionInfo.Callstack(); WriteCallStack(callstack); m_spWriter->WriteEndElement(); }