summaryrefslogtreecommitdiff
path: root/absl/debugging
diff options
context:
space:
mode:
authorGravatar Andrei Polushin <polushin@gmail.com>2022-07-13 02:09:10 +0700
committerGravatar Andrei Polushin <polushin@gmail.com>2022-07-13 15:29:25 +0700
commit0565e00b93a5346273ce49cf7706ebc642162272 (patch)
tree819f1900babf4eeb3e155a3bd43177a3ecf63536 /absl/debugging
parente517aaf499f88383000d4ddf6b84417fbbb48791 (diff)
Disable sigaltstack() on macOS to make backtrace() work.
There are many reports that sigaltstack() on Apple platforms stops backtrace() from tracing an original stack, e.g. * https://github.com/llvm/llvm-project/commit/d39ead41056b00d10b6223543562cd304307ac9b * https://reviews.llvm.org/D28265 If we disable an alternate stack for signal handler, we won't be able to catch stack overflow errors, but backrace() will work again.
Diffstat (limited to 'absl/debugging')
-rw-r--r--absl/debugging/failure_signal_handler.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/absl/debugging/failure_signal_handler.cc b/absl/debugging/failure_signal_handler.cc
index affade3b..c6243305 100644
--- a/absl/debugging/failure_signal_handler.cc
+++ b/absl/debugging/failure_signal_handler.cc
@@ -50,7 +50,9 @@
#ifndef _WIN32
#define ABSL_HAVE_SIGACTION
// Apple WatchOS and TVOS don't allow sigaltstack
-#if !(defined(TARGET_OS_WATCH) && TARGET_OS_WATCH) && \
+// Apple macOS has sigaltstack, but using it makes backtrace() unusable.
+#if !(defined(TARGET_OS_OSX) && TARGET_OS_OSX) && \
+ !(defined(TARGET_OS_WATCH) && TARGET_OS_WATCH) && \
!(defined(TARGET_OS_TV) && TARGET_OS_TV) && !defined(__QNX__)
#define ABSL_HAVE_SIGALTSTACK
#endif