From 11855d8ef08567c7961fb3c6562fbe6f9b479092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Lei=C3=9Fa?= Date: Wed, 28 Mar 2018 23:45:51 +0200 Subject: [PATCH 1/2] provide alternative for DebugBreak() This uses asm("int3") for clang/gcc on x86 as alternative for DebugBreak() --- googletest/src/gtest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 9079af8d..74067bc3 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4549,6 +4549,9 @@ void UnitTest::AddTestPartResult( // when a failure happens and both the --gtest_break_on_failure and // the --gtest_catch_exceptions flags are specified. DebugBreak(); +#elif (defined(__clang__) || defined(__GNUC__)) && (defined(__x86_64__) || defined(__i386__)) + // with clang/gcc we can acchieve the same effect on x86 by invoking int3 + asm("int3"); #else // Dereference NULL through a volatile pointer to prevent the compiler // from removing. We use this rather than abort() or __builtin_trap() for From d04bf07fadd204881df4c7114906fa63b1b80c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Lei=C3=9Fa?= Date: Thu, 29 Mar 2018 16:38:23 +0200 Subject: [PATCH 2/2] typo --- googletest/src/gtest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 74067bc3..725aa089 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4550,7 +4550,7 @@ void UnitTest::AddTestPartResult( // the --gtest_catch_exceptions flags are specified. DebugBreak(); #elif (defined(__clang__) || defined(__GNUC__)) && (defined(__x86_64__) || defined(__i386__)) - // with clang/gcc we can acchieve the same effect on x86 by invoking int3 + // with clang/gcc we can achieve the same effect on x86 by invoking int3 asm("int3"); #else // Dereference NULL through a volatile pointer to prevent the compiler