Disable exception handling while debugging c++ project using Google Test

不羁的心 提交于 2020-05-09 01:21:35

问题


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.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/9293467/disable-exception-handling-while-debugging-c-project-using-google-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!