使用Google Test调试C ++项目时禁用异常处理 [英] Disable exception handling while debugging c++ project using Google Test

查看:241
本文介绍了使用Google Test调试C ++项目时禁用异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的(本机C ++)DLL项目和一个基于Google Test的相应测试EXE项目。通过此EXE调试DLL时,我有由Google Test自动处理的异常。因此,如果我的DLL在调试期间引发未处理的异常,则我希望看到Visual Studio发出的错误消息,其中,调试会话在代码导致异常之后被暂停。相反,我在gtest.cc中触发了断点。如果禁用-gtest_break_on_failure 标志,我将不会收到任何中断。

I have my (native C++) DLL project and a corresponding test EXE project based on Google Test. While debugging my DLL via this EXE I have exceptions automatically handled by Google Test. So if my DLL throws an unhandled exception during debug, I expect to see error message from Visual Studio with debug session paused after the code caused exception. Instead, I have breakpoint triggered in gtest.cc. And if I disable --gtest_break_on_failure flag I will receive no breaks at all.

我在Google测试文档。我错过了吗?我不想在Debug设置中检查抛出时中断标志中的不同异常,因为我只对未处理的异常感兴趣。

I found no such option in Google Test documentation. Have I missed it? I don't want to check "break when thrown" flag for different exceptions in Debug settings, because I'm only interested in unhandled ones.

推荐答案

答案在高级部分的 禁用捕获测试引发异常。您要做的就是使用-gtest_catch_exceptions = 0 调用您的二进制文件。

The answer is in the Advanced page section called "Disabling Catching Test-Thrown Exceptions". What you have to do is invoke your binary with --gtest_catch_exceptions=0.

这篇关于使用Google Test调试C ++项目时禁用异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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