Capturing R6025 pure virtual call

后端 未结 3 1997
鱼传尺愫
鱼传尺愫 2020-12-13 20:52

I currently capture MiniDumps of unhandled exceptions using SetUnhandledExceptionFilter however at times I am getting \"R6025: pure virtual function\".

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 21:40

    If you want to catch all crashes you have to do more than just: SetUnhandledExceptionFilter

    I would also set the abort handler, the purecall handler, unexpected, terminate, and invalid parameter handler.

    #include 
    
    inline void signal_handler(int)
    {
        terminator();
    }
    
    inline void terminator() 
    {
        int*z = 0; *z=13; 
    }
    
    inline void __cdecl invalid_parameter_handler(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t)
    {
       terminator();
    } 
    

    And in your main put this:

     signal(SIGABRT, signal_handler);
     _set_abort_behavior(0, _WRITE_ABORT_MSG|_CALL_REPORTFAULT);
    
     set_terminate( &terminator );
     set_unexpected( &terminator );
     _set_purecall_handler( &terminator );
     _set_invalid_parameter_handler( &invalid_parameter_handler );
    

    The above will send all crashes to your unhandled exception handler.

提交回复
热议问题