Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

c++ - Capturing R6025 pure virtual call

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

I understand how a pure virtual function call happens I am just wondering if it is possible to capture them so I can create a MiniDump at that point.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 <signal.h>

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...