string Exception::getFullDescription() { char line[30]; sprintf( line, "%d", mLine ); string str( "An exception has been thrown.\n\n" ); str += "--------------------DETAILS--------------------------\n" ; str += " Code : " + codeToStr( mCode ) ; str += "\n Desc : " + mDesc; str += "\n Source : " + mSource; str += "\n File : " + mFile; str += "\n Line : " + string( line ); str += "\n----------------------------------------------------"; return str; }
LONG WINAPI PlatformExceptionHandler::handler(LPEXCEPTION_POINTERS pointers) { DWORD exceptionCode = pointers->ExceptionRecord->ExceptionCode; ULONG_PTR *exceptionInfo = pointers->ExceptionRecord->ExceptionInformation; string description = codeToStr(exceptionCode); DebugSymbolEngine &symbolEngine = DebugSymbolEngine::instance(); if (exceptionCode == EXCEPTION_ACCESS_VIOLATION) { description += " ("; description += exceptionInfo[0] == 0 ? "Reading" : "Writing"; description += " address: 0x" + intToHex(static_cast<int>(exceptionInfo[1])) + ")"; } std::ostringstream ss; symbolEngine.StackTrace(pointers->ContextRecord, ss); description += "\n\nCall Stack:\n"; description += ss.str(); singleton->log(description.c_str(), pointers->ExceptionRecord->ExceptionAddress, NULL, 0, NULL); singleton->notifyUser(false); return EXCEPTION_EXECUTE_HANDLER; }