Search code examples
gdbgoogletest

gtest: where to put gdb breakpoint


I am using various xunit tests for years (starting from cppunit in early 2000s). In all cases it was very easy to set a break point on failure: there was a function that indicated detected failure:

b 'atf::tests::tc::fail(std::string const&)' command up 1 end

It seems that gtest is quite different, what is the established practice of doing the same with gtest?


Solution

  • what is the established practice of doing the same with gtest?

    Reading gtest.cc, the closest I see is --gunit_break_on_failure, which should cause the code to execute INT3 trap on x86/Linux, and to call DebugBreak on Windows.

    Update: the flag appears to have been renamed to --gtest_break_on_failure in latest public releases.