aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Frankland <jack.frankland@arm.com>2023-08-12 13:49:26 +0100
committerEric Kunze <eric.kunze@arm.com>2023-09-06 17:13:51 +0000
commitfe03f80b4ed28a4901d6419a150b2ae912c923a5 (patch)
tree35cdf5e6045a96076bb8f07e31828f8704b631da
parente70d93175afb3bc053d264a02be2156a7354039c (diff)
downloadreference_model-fe03f80b4ed28a4901d6419a150b2ae912c923a5.tar.gz
fix: Conditionally include `prctl.h` on macos
MacOS does not have the `sys/prctl.h` header. This patch conditionally excludes `prctl.h` on MacOS and usage of its functionality in the same way we currently do for windows. Signed-off-by: Jack Frankland <jack.frankland@arm.com> Change-Id: Ic56ec358552126b3a10827d9c52db388a8acc214
-rw-r--r--reference_model/src/func_debug.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/reference_model/src/func_debug.cc b/reference_model/src/func_debug.cc
index 7979c89..3ebae59 100644
--- a/reference_model/src/func_debug.cc
+++ b/reference_model/src/func_debug.cc
@@ -24,7 +24,9 @@
#ifndef _MSC_VER
#include <execinfo.h>
+#if !defined(__APPLE__) && !defined(__MACH__)
#include <sys/prctl.h>
+#endif
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -40,13 +42,13 @@ static bool str_case_equal(const std::string& a, const std::string& b)
[](char ac, char bc) { return tolower(ac) == tolower(bc); });
}
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
pid_t func_print_backtrace_helper(int num_tries, int sig);
#endif
void func_print_backtrace(FILE* out, int sig)
{
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
for (int i = 0; i < 2; i++)
{
const pid_t child_pid = func_print_backtrace_helper(i, sig);
@@ -66,7 +68,7 @@ void func_print_backtrace(FILE* out, int sig)
#endif
}
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__MACH__)
pid_t func_print_backtrace_helper(int num_tries, int sig)
{
const pid_t child_pid = fork();