捕获R6025纯虚拟呼叫 [英] Capturing R6025 pure virtual call

查看:186
本文介绍了捕获R6025纯虚拟呼叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用 SetUnhandledExceptionFilter 捕获未处理的异常的MiniDumps,但有时我得到R6025:纯虚函数。

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

我知道一个纯虚函数调用发生了什么,我只是想知道是否可以捕获它们,所以我可以创建一个MiniDump在这一点。

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.

推荐答案

如果你想捕获所有的崩溃,你必须做的不仅仅是:SetUnhandledExceptionFilter

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

我还将设置中止处理程序,purecall处理程序,意外,终止和无效的参数处理程序。

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();
}

在您的主要输入:

 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.

这篇关于捕获R6025纯虚拟呼叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆