diff options
author | Jack Frankland <jack.frankland@arm.com> | 2023-08-12 13:49:26 +0100 |
---|---|---|
committer | Jerry Ge <jerry.ge@arm.com> | 2024-01-29 17:21:47 +0000 |
commit | 140c54010361c711c611666d4d367d71d5c95327 (patch) | |
tree | 31b1290b394ed3ee05d29513af094ca18801ec37 | |
parent | 12699f02130d784db10c5600465c3f1d1dda32dd (diff) | |
download | reference_model-140c54010361c711c611666d4d367d71d5c95327.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.cc | 8 |
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(); |