void setupSynchronousSignalHandlers() { std::set_terminate(myTerminate); std::set_new_handler(reportOutOfMemoryErrorAndExit); // SIGABRT is the only signal we want handled by signal handlers on both windows and posix. invariant(signal(SIGABRT, abruptQuit) != SIG_ERR); #if defined(_WIN32) _set_purecall_handler(myPureCallHandler); _set_invalid_parameter_handler(myInvalidParameterHandler); setWindowsUnhandledExceptionFilter(); #else invariant(signal(SIGHUP, SIG_IGN) != SIG_ERR); invariant(signal(SIGUSR2, SIG_IGN) != SIG_ERR); invariant(signal(SIGPIPE, SIG_IGN) != SIG_ERR); struct sigaction addrSignals; memset(&addrSignals, 0, sizeof(struct sigaction)); addrSignals.sa_sigaction = abruptQuitWithAddrSignal; sigemptyset(&addrSignals.sa_mask); addrSignals.sa_flags = SA_SIGINFO; // ^\ is the stronger ^C. Log and quit hard without waiting for cleanup. invariant(signal(SIGQUIT, abruptQuit) != SIG_ERR); invariant(sigaction(SIGSEGV, &addrSignals, 0) == 0); invariant(sigaction(SIGBUS, &addrSignals, 0) == 0); invariant(sigaction(SIGILL, &addrSignals, 0) == 0); invariant(sigaction(SIGFPE, &addrSignals, 0) == 0); setupSIGTRAPforGDB(); #endif }
void CCrashHandler::SetProcessExceptionHandlers() { // Install top-level SEH handler SetUnhandledExceptionFilter(SehHandler); // Catch pure virtual function calls. // Because there is one _purecall_handler for the whole process, // calling this function immediately impacts all threads. The last // caller on any thread sets the handler. // http://msdn.microsoft.com/en-us/library/t296ys27.aspx _set_purecall_handler(PureCallHandler); // Catch new operator memory allocation exceptions _set_new_handler(NewHandler); // Catch invalid parameter exceptions. _set_invalid_parameter_handler(InvalidParameterHandler); // Set up C++ signal handlers //_set_abort_behavior(_CALL_REPORTFAULT,_CALL_REPORTFAULT); _set_abort_behavior(_WRITE_ABORT_MSG|_CALL_REPORTFAULT, _WRITE_ABORT_MSG|_CALL_REPORTFAULT); _set_abort_behavior(0, _WRITE_ABORT_MSG); // Catch an abnormal program termination signal(SIGABRT, SigabrtHandler); // Catch illegal instruction handler signal(SIGINT, SigintHandler); // Catch a termination request signal(SIGTERM, SigtermHandler); }
void setupSignals() { if( SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, TRUE ) ) ; else massert( 10297 , "Couldn't register Windows Ctrl-C handler", false); _set_purecall_handler( myPurecallHandler ); }
void CDumpCatch::UnSetInvalidHandle() { #if _MSC_VER >= 1400 // MSVC 2005/8 _set_invalid_parameter_handler(m_preIph); #endif // _MSC_VER >= 1400 _set_purecall_handler(m_prePch); //At application this can stop show the error message box. }
void CDumpCatch::SetInvalidHandle() { #if _MSC_VER >= 1400 // MSVC 2005/8 m_preIph = _set_invalid_parameter_handler(MyInvalidParameterHandler); #endif // _MSC_VER >= 1400 m_prePch = _set_purecall_handler(MyPureCallHandler); //At application, this call can stop show the error message box. }
void exception_catcher::set_process_exception_handlers() { // Install top-level SEH handler SetUnhandledExceptionFilter(catched_seh_handler); // Catch pure virtual function calls. // Because there is one _purecall_handler for the whole process, // calling this function immediately impacts all threads. The last // caller on any thread sets the handler. // http://msdn.microsoft.com/en-us/library/t296ys27.aspx _set_purecall_handler(catched_pure_call_handler); // Catch new operator memory allocation exceptions _set_new_handler(catched_new_handler); // Catch invalid parameter exceptions. _set_invalid_parameter_handler(catched_invalid_parameter_handler); // Set up C++ signal handlers _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT); // Catch an abnormal program termination signal(SIGABRT, catched_sigabrt_handler); // Catch illegal instruction handler signal(SIGINT, catched_sigint_handler); // Catch a termination request signal(SIGTERM, catched_sigterm_handler); }
sbTestHarnessConsoleListener::sbTestHarnessConsoleListener() { // XXX Mook temp hack #if XP_WIN _set_purecall_handler(sb_purecall_handler); #endif MOZ_COUNT_CTOR(sbTestHarnessConsoleListener); }
void FWinRTMisc::PlatformPreInit() { FGenericPlatformMisc::PlatformPreInit(); // Use our own handler for pure virtuals being called. DefaultPureCallHandler = _set_purecall_handler(PureCallHandler); // initialize the file SHA hash mapping InitSHAHashes(); }
extern "C" void cbStartup() { cbLock = CreateMutex( NULL, FALSE, NULL ); cbReportData = NULL; swprintf_s( cbShareName, 256, L"CrashBack_%x", GetCurrentProcessId() ); GetModuleFileName( NULL, cbReportExePath, MAX_PATH ); wcscpy_s( cbReportExeDir, MAX_PATH, cbReportExePath ); wchar_t *p = wcsrchr( cbReportExeDir, '\\' ); if ( p ) *p = 0; wcscpy_s( cbReportExePath, MAX_PATH, cbReportExeDir ); wcscat_s( cbReportExePath, MAX_PATH, L"\\" ); wcscat_s( cbReportExePath, MAX_PATH, L"crashreport.exe" ); // Check that crashreport.exe exists in the app's directory. if ( GetFileAttributes( cbReportExePath ) == INVALID_FILE_ATTRIBUTES ) return; swprintf_s( cbReportCmdLine, 1024, L"\"%s\" 0x%x", cbReportExePath, GetCurrentProcessId() ); cbGetProgramName(); cbGetCmdLine(); // Set up shared memory to communicate with the report handler EXE. HANDLE hShared = CreateFileMapping( INVALID_HANDLE_VALUE, // use paging file NULL, // default security PAGE_READWRITE, // read/write access 0, // max. object size sizeof(CbReport), // buffer size cbShareName ); // name of mapping object if ( !hShared ) return; cbReportData = (CbReport *)MapViewOfFile( hShared, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(CbReport) ); if ( !cbReportData ) { CloseHandle( hShared ); return; } // Register the handlers. SetUnhandledExceptionFilter( &cbExceptionHandler ); _set_error_mode( _OUT_TO_STDERR ); _set_purecall_handler( cbPureCallHandler ); _set_new_mode( 1 ); // malloc calls the new handler on failure _set_new_handler( cbNewHandler ); _set_invalid_parameter_handler( cbInvalidParameterHandler ); _set_abort_behavior( _CALL_REPORTFAULT, _CALL_REPORTFAULT ); }
void CrashHandlerWindows::unregisterCrashHandlers() { unregisterThreadCrashHandlers(); SetUnhandledExceptionFilter(m_pPreviousCrashHandlers->m_SEHHandler); _set_purecall_handler(m_pPreviousCrashHandlers->m_pureCallHandler); _set_new_handler(m_pPreviousCrashHandlers->m_newHandler); _set_invalid_parameter_handler(m_pPreviousCrashHandlers->m_invalidParameterHandler); signal(SIGABRT, m_pPreviousCrashHandlers->m_SIGABRTHandler); signal(SIGINT, m_pPreviousCrashHandlers->m_SIGINTHandler); signal(SIGTERM, m_pPreviousCrashHandlers->m_SIGTERMHandler); if(!m_pPreviousCrashHandlers->m_threadExceptionHandlers.empty()) LogWarning << "Some threads crash handlers are still registered."; delete m_pPreviousCrashHandlers; m_pPreviousCrashHandlers = 0; }
BOOL CMainApp::InitInstance() { if(!CheckSingleInstance()) { return FALSE; } // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); //虚函数调用捕获 _set_purecall_handler(PurecallHandler); module_manager.PushEvent(MakeEvent<MODULE_ID_CORE>()(Hall::EVENT_VALUE_HALL_CREATEANDSHOW,MODULE_ID_HALL)); //module_manager.PushEvent(MakeEvent<MODULE_ID_ROOM>()(Room::EVENT_VALUE_TEST,MODULE_ID_ROOM)); //模块管理单元启动 module_manager.Construct(); module_manager.run(); module_manager.Destruct(); return FALSE; }
void setupSignalHandlers() { set_terminate( myTerminate ); set_new_handler( myNewHandler ); // SIGABRT is the only signal we want handled by signal handlers on both windows and posix. invariant( signal(SIGABRT, abruptQuit) != SIG_ERR ); #ifdef _WIN32 _set_purecall_handler( ::abort ); // TODO improve? setWindowsUnhandledExceptionFilter(); massert(10297, "Couldn't register Windows Ctrl-C handler", SetConsoleCtrlHandler(static_cast<PHANDLER_ROUTINE>(CtrlHandler), TRUE)); #else invariant( signal(SIGHUP , SIG_IGN ) != SIG_ERR ); invariant( signal(SIGUSR2, SIG_IGN ) != SIG_ERR ); invariant( signal(SIGPIPE, SIG_IGN) != SIG_ERR ); struct sigaction addrSignals; memset( &addrSignals, 0, sizeof( struct sigaction ) ); addrSignals.sa_sigaction = abruptQuitWithAddrSignal; sigemptyset( &addrSignals.sa_mask ); addrSignals.sa_flags = SA_SIGINFO; invariant( sigaction(SIGSEGV, &addrSignals, 0) == 0 ); invariant( sigaction(SIGBUS, &addrSignals, 0) == 0 ); invariant( sigaction(SIGILL, &addrSignals, 0) == 0 ); invariant( sigaction(SIGFPE, &addrSignals, 0) == 0 ); setupSIGTRAPforGDB(); // asyncSignals is a global variable listing the signals that should be handled by the // interrupt thread, once it is started via startSignalProcessingThread(). sigemptyset( &asyncSignals ); sigaddset( &asyncSignals, SIGHUP ); sigaddset( &asyncSignals, SIGINT ); sigaddset( &asyncSignals, SIGTERM ); sigaddset( &asyncSignals, SIGQUIT ); sigaddset( &asyncSignals, SIGUSR1 ); sigaddset( &asyncSignals, SIGXCPU ); #endif }
int __cdecl main(int, char**) { #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #else _set_purecall_handler(purecallHandler); #endif LOGMODE(LOG_FILE); TitanFileSystem* fs = new TitanFileSystem("E:\\rose servers\\SHO\\srvDATA\\"); FileSystem::SetFileSystem(fs); gWindow->SetSize(1024, 768); gWindow->SetTitle("Map Viewer 0.0 using Exjam's R3E"); gWindow->Create(); gStateManager->EnqueueState(new LoadState(4)); //gStateManager->EnqueueState(new LoginState()); CreateThread(NULL, 0, &StateManRun, 0, 0, 0); CreateThread(NULL, 0, &NetManRun, 0, 0, 0); int ret = gWindow->Run(); gStateManager->WaitEnd(); gNetwork->WaitEnd(); gWindow->SetOpenGLThread(); SAFE_DELETE(gScene); SAFE_DELETE(fs); SAFE_DELETE(gNetwork); SAFE_DELETE(gGameEvents); SAFE_DELETE(gInterface); SAFE_DELETE(gStateManager); SAFE_DELETE(gCharacterList); gWindow->Destroy(); SAFE_DELETE(gWindow); return ret; }
static void ssh_set_exceptionHandlers() { // установить фильтр исключений SetUnhandledExceptionFilter(Win32UnhandledExceptionFilter); // установить режимы отчета библиотеки времени выполнения //_CrtSetReportMode(_CRT_ERROR, 0); _CrtSetReportMode(_CRT_ASSERT, 0); set_terminate(ssh_terminate_handler); set_unexpected(ssh_unexp_handler); _set_purecall_handler(ssh_purecall_handler); _set_invalid_parameter_handler(ssh_invalid_parameter_handler); _set_new_handler(ssh_new_handler); // _set_security_error_handler(ssh_security_handler); signal(SIGABRT, ssh_signal_handler); signal(SIGINT, ssh_signal_handler); signal(SIGTERM, ssh_signal_handler); signal(SIGFPE, ssh_signal_handler); signal(SIGILL, ssh_signal_handler); signal(SIGSEGV, ssh_signal_handler); }
bool CrashHandlerWindows::registerCrashHandlers() { arx_assert(m_pPreviousCrashHandlers == 0); m_pPreviousCrashHandlers = new PlatformCrashHandlers; // Unhandled exception handler. m_pPreviousCrashHandlers->m_SEHHandler = SetUnhandledExceptionFilter(SEHHandler); // Prevent dialog box. _set_error_mode(_OUT_TO_STDERR); // Catch pure virtual function calls. // Because there is one _purecall_handler for the whole process, // calling this function immediately impacts all threads. The last // caller on any thread sets the handler. // http://msdn.microsoft.com/en-us/library/t296ys27.aspx m_pPreviousCrashHandlers->m_pureCallHandler = _set_purecall_handler(PureCallHandler); // Catch new operator memory allocation exceptions. _set_new_mode(1); // Force malloc() to call new handler too m_pPreviousCrashHandlers->m_newHandler = _set_new_handler(NewHandler); // Catch invalid parameter exceptions. m_pPreviousCrashHandlers->m_invalidParameterHandler = _set_invalid_parameter_handler(InvalidParameterHandler); // Catch an abnormal program termination. _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT); m_pPreviousCrashHandlers->m_SIGABRTHandler = signal(SIGABRT, SignalHandler); // Catch illegal instruction handler. m_pPreviousCrashHandlers->m_SIGINTHandler = signal(SIGINT, SignalHandler); // Catch a termination request. m_pPreviousCrashHandlers->m_SIGTERMHandler = signal(SIGTERM, SignalHandler); // We must also register the main thread crash handlers. return registerThreadCrashHandlers(); }
void CORE_API set_process_exception_handler(wchar_t const* app_name, wchar_t const* report_contact) { if (app_name) { wcsncpy(app_name_, app_name, MAX_APP_NAME_LEN); } else { wchar_t filename[MAX_PATH + 1]; GetModuleFileNameW(NULL, filename, MAX_PATH); _wsplitpath(filename, nullptr, nullptr, filename, nullptr); wcsncpy(app_name_, filename, MAX_APP_NAME_LEN); } if (report_contact) { wcsncpy(report_contact_, report_contact, MAX_REPORT_CONTACT_LEN); } // SEH handler ::SetUnhandledExceptionFilter(handle_seh); #if _MSC_VER>=1400 // Visual C++ CRT handlers _set_error_mode(_OUT_TO_STDERR); _set_purecall_handler(handle_purecall); //_set_new_handler(1); _set_invalid_parameter_handler(handle_invalid_parameter); _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT); #endif set_thread_exception_handlers(); }
void TestPureCall() { _set_purecall_handler(HandlePureCall); class CPure { public: CPure(){}; virtual ~CPure(){ test2(); }; virtual void test() = 0; void test2() { test(); } }; class CPureB : public CPure { public: CPureB(){}; virtual ~CPureB(){}; virtual void test() { printf("b....\r\n"); } }; try { CPure* p = new CPureB; delete p; } catch (const std::exception& ex) { printf("catch(exception):%s\r\n", ex.what()); } catch (...) { printf("catch(...)\r\n"); } }
int CCrashHandler::UnSetProcessExceptionHandlers() { crSetErrorMsg(_T("Unspecified error.")); // Unset all previously set handlers #if _MSC_VER>=1300 if(m_prevPurec!=NULL) _set_purecall_handler(m_prevPurec); if(m_prevNewHandler!=NULL) _set_new_handler(m_prevNewHandler); #endif #if _MSC_VER>=1400 if(m_prevInvpar!=NULL) _set_invalid_parameter_handler(m_prevInvpar); #endif //_MSC_VER>=1400 #if _MSC_VER>=1300 && _MSC_VER<1400 if(m_prevSec!=NULL) _set_security_error_handler(m_prevSec); #endif //_MSC_VER<1400 if(m_prevSigABRT!=NULL) signal(SIGABRT, m_prevSigABRT); if(m_prevSigINT!=NULL) signal(SIGINT, m_prevSigINT); if(m_prevSigTERM!=NULL) signal(SIGTERM, m_prevSigTERM); crSetErrorMsg(_T("Success.")); return 0; }
//------------------------------------------------------------------------------------------------- // 主程序入口 //------------------------------------------------------------------------------------------------- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // // VS2005之后的版本,微软增加了一些新的异常机制,新机制在出现错误时默认不通知应用程序, // 这时程序就崩溃了.所以这种情况下,必须调用_set_invalid_parameter_handler、 // _set_purecall_handler设置自己的异常处理函数。 // // _set_invalid_parameter_handler // 许多C运行时函数检查参数有效性传递给它们。如果无效参数传递,该功能可以设置errno错误号 // 或返回错误代码。在这种情况下,参数无效处理程序调用。此功能允许该处理程序设置为另一个函数 // // _set_purecall_handler // Error-Handling Routines, Sets the handler for a pure virtual function call. // // set_terminate // Exception-Handling Functions, Install your own termination routine to be called by terminate // _set_invalid_parameter_handler(InvalidParameterHandler); _set_purecall_handler(MakeDump); set_terminate(MakeDump); // Hook Windows内存分配函数 //HookMemoryFunction(); // vld //__VLD_THREEAD_NAME; //__VLD_THREAD_TRACE_AUTO; // profile统计注册 //sdPF_Func_Register() // 游戏启动标志 ::CreateMutex(NULL, TRUE, "wzclient"); // 硬件与软件检查 // CheckSystem() // 注册CRT退出回调函数 // atexit(ExitDump) // 加载多线程渲染库 //HMODULE hMTDirectX9 = NULL; //if (true) //{ // std::vector<std::string> kCheckProcessVec; // kCheckProcessVec.push_back("fraps.exe"); ///< 运行fraps.exe时不开启多线程渲染 // if (!IsProcessRunning(sdUtil::IsProcessRunning(kCheckProcessVec))) // hMTDirectX9 = ::LoadLibrary("MTDirectX9.dll"); //} // 开启多线程角色更新 // 加载进度条 //g_pkLoadingDlg = new sdLoadingDlg; //g_pkLoadingDlg->Initialize(); // 客户端初始化 g_pkGameClient = new sdGameClient; assert(g_pkGameClient); g_pkGameClient->Initialize(hInstance); // 销毁进度条 //g_pkLoadingDlg->Destroy(); //delete g_pkLoadingDlg; //g_pkLoadingDlg = NULL; // 显示客户端窗口 ::ShowWindow(g_pkGameClient->GetWindowHandle(), SW_SHOWNORMAL); ::UpdateWindow(g_pkGameClient->GetWindowHandle()); // 客户端运行循环 while(g_pkGameClient->Run()); // 客户端销毁 g_pkGameClient->Destroy(); delete g_pkGameClient; g_pkGameClient = NULL; // 卸载多线程渲染库 //if (hMTDirectX9 != NULL) //{ // ::FreeLibrary(hMTDirectX9); // hMTDirectX9 = NULL; //} // 客户端结束后调用浏览器之类的 //::CreateProcess(); return 0; };
void setupSynchronousSignalHandlers() { std::set_terminate(myTerminate); std::set_new_handler(reportOutOfMemoryErrorAndExit); #if defined(_WIN32) invariant(signal(SIGABRT, abruptQuit) != SIG_ERR); _set_purecall_handler(myPureCallHandler); _set_invalid_parameter_handler(myInvalidParameterHandler); setWindowsUnhandledExceptionFilter(); #else { struct sigaction ignoredSignals; memset(&ignoredSignals, 0, sizeof(ignoredSignals)); ignoredSignals.sa_handler = SIG_IGN; sigemptyset(&ignoredSignals.sa_mask); invariant(sigaction(SIGHUP, &ignoredSignals, nullptr) == 0); invariant(sigaction(SIGUSR2, &ignoredSignals, nullptr) == 0); invariant(sigaction(SIGPIPE, &ignoredSignals, nullptr) == 0); } { struct sigaction plainSignals; memset(&plainSignals, 0, sizeof(plainSignals)); plainSignals.sa_handler = abruptQuit; sigemptyset(&plainSignals.sa_mask); // ^\ is the stronger ^C. Log and quit hard without waiting for cleanup. invariant(sigaction(SIGQUIT, &plainSignals, nullptr) == 0); #if __has_feature(address_sanitizer) // Sanitizers may be configured to call abort(). If so, we should omit our signal handler. bool shouldRegister = true; constexpr std::array<StringData, 5> sanitizerConfigVariable{"ASAN_OPTIONS"_sd, "TSAN_OPTIONS"_sd, "MSAN_OPTIONS"_sd, "UBSAN_OPTIONS"_sd, "LSAN_OPTIONS"_sd}; for (const StringData& option : sanitizerConfigVariable) { StringData configString(getenv(option.rawData())); if (configString.find("abort_on_error=1") != std::string::npos || configString.find("abort_on_error=true") != std::string::npos) { shouldRegister = false; } } if (shouldRegister) { invariant(sigaction(SIGABRT, &plainSignals, nullptr) == 0); } #else invariant(sigaction(SIGABRT, &plainSignals, nullptr) == 0); #endif } { struct sigaction addrSignals; memset(&addrSignals, 0, sizeof(addrSignals)); addrSignals.sa_sigaction = abruptQuitWithAddrSignal; sigemptyset(&addrSignals.sa_mask); addrSignals.sa_flags = SA_SIGINFO; invariant(sigaction(SIGSEGV, &addrSignals, nullptr) == 0); invariant(sigaction(SIGBUS, &addrSignals, nullptr) == 0); invariant(sigaction(SIGILL, &addrSignals, nullptr) == 0); invariant(sigaction(SIGFPE, &addrSignals, nullptr) == 0); } setupSIGTRAPforGDB(); #endif }
int CCrashHandler::SetProcessExceptionHandlers(DWORD dwFlags) { crSetErrorMsg(_T("Unspecified error.")); // If 0 is specified as dwFlags, assume all handlers should be // installed if((dwFlags&0x1FF)==0) dwFlags |= 0x1FFF; if(dwFlags&CR_INST_STRUCTURED_EXCEPTION_HANDLER) { // Install top-level SEH handler m_oldSehHandler = SetUnhandledExceptionFilter(SehHandler); } _set_error_mode(_OUT_TO_STDERR); #if _MSC_VER>=1300 if(dwFlags&CR_INST_PURE_CALL_HANDLER) { // Catch pure virtual function calls. // Because there is one _purecall_handler for the whole process, // calling this function immediately impacts all threads. The last // caller on any thread sets the handler. // http://msdn.microsoft.com/en-us/library/t296ys27.aspx m_prevPurec = _set_purecall_handler(PureCallHandler); } if(dwFlags&CR_INST_NEW_OPERATOR_ERROR_HANDLER) { // Catch new operator memory allocation exceptions _set_new_mode(1); // Force malloc() to call new handler too m_prevNewHandler = _set_new_handler(NewHandler); } #endif #if _MSC_VER>=1400 if(dwFlags&CR_INST_INVALID_PARAMETER_HANDLER) { // Catch invalid parameter exceptions. m_prevInvpar = _set_invalid_parameter_handler(InvalidParameterHandler); } #endif #if _MSC_VER>=1300 && _MSC_VER<1400 if(dwFlags&CR_INST_SECURITY_ERROR_HANDLER) { // Catch buffer overrun exceptions // The _set_security_error_handler is deprecated in VC8 C++ run time library m_prevSec = _set_security_error_handler(SecurityHandler); } #endif // Set up C++ signal handlers if(dwFlags&CR_INST_SIGABRT_HANDLER) { #if _MSC_VER>=1400 _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT); #endif // Catch an abnormal program termination m_prevSigABRT = signal(SIGABRT, SigabrtHandler); } if(dwFlags&CR_INST_SIGILL_HANDLER) { // Catch illegal instruction handler m_prevSigINT = signal(SIGINT, SigintHandler); } if(dwFlags&CR_INST_TERMINATE_HANDLER) { // Catch a termination request m_prevSigTERM = signal(SIGTERM, SigtermHandler); } crSetErrorMsg(_T("Success.")); return 0; }
void DebugTools::UsePurecallHandler() { _set_purecall_handler(SelfPurecallHandler); }
ErrorHandlerRegistrar::ErrorHandlerRegistrar() { _set_purecall_handler( VPureCall ); _set_invalid_parameter_handler( VInvalidParameterHandler ); }