Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_debugger.cpp
diff options
context:
space:
mode:
authorTorfinn Berset2019-04-05 11:39:13 +0200
committerMartin Hořeňovský2019-04-10 10:19:54 +0200
commit5ce355a38c54bbcd486e51ed6f6bb00c46c7540f (patch)
treefddf9f07e56393edc8928a666735a5e761591fd3 /include/internal/catch_debugger.cpp
parentedde6f473604c6364476d2963939272ac7c795d4 (diff)
downloadcatch3-5ce355a38c54bbcd486e51ed6f6bb00c46c7540f.tar.gz
For macOS builds, disable isDebuggerActive() for non-AppleClang targets. Fixes #1588
Diffstat (limited to 'include/internal/catch_debugger.cpp')
-rw-r--r--include/internal/catch_debugger.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/include/internal/catch_debugger.cpp b/include/internal/catch_debugger.cpp
index 71dc6506..f04900a4 100644
--- a/include/internal/catch_debugger.cpp
+++ b/include/internal/catch_debugger.cpp
@@ -18,19 +18,23 @@
# include <stdbool.h>
# include <sys/types.h>
# include <unistd.h>
-# include <sys/sysctl.h>
# include <cstddef>
# include <ostream>
-namespace Catch {
+#ifdef __apple_build_version__
+ // These headers will only compile with AppleClang (XCode)
+ // For other compilers (Clang, GCC, ... ) we need to exclude them
+# include <sys/sysctl.h>
+#endif
+ namespace Catch {
+ #ifdef __apple_build_version__
// The following function is taken directly from the following technical note:
- // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
+ // https://developer.apple.com/library/archive/qa/qa1361/_index.html
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).
bool isDebuggerActive(){
-
int mib[4];
struct kinfo_proc info;
std::size_t size;
@@ -60,6 +64,12 @@ namespace Catch {
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
}
+ #else
+ bool isDebuggerActive() {
+ // We need to find another way to determine this for non-appleclang compilers on macOS
+ return false;
+ }
+ #endif
} // namespace Catch
#elif defined(CATCH_PLATFORM_LINUX)