Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Disable sigaltstack on Apple platforms
Browse files Browse the repository at this point in the history
Using sigaltstack on Apple platforms is a bad idea. Darwin's backtrace()
function does not work with sigaltstack, and my change in r286851 was
supposed to solve that by using _Unwind_Backtrace instead. I tested that
_Unwind_Backtrace works for crashes but then discovered that it does not
work for assertion failures when using sigaltstack, at least on macOS.
The stack trace shows only the frames on the alternate stack.
I also saw some reports of this happening for crashes, but it fails
consistently for assertion failures. I tried various things to get it to
work but the problem seems to be in _Unwind_Backtrace itself. Disabling
sigaltstack is unfortunate since it would be nice to get backtraces for
stack overflows, but at least this gets us backtraces for the more common
cases. rdar://problem/29662459

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291206 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bob-wilson committed Jan 6, 2017
1 parent 10106fb commit 43d2cb1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmake/config-ix.cmake
Expand Up @@ -169,7 +169,10 @@ if( HAVE_SETJMP_H )
check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP)
check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP)
endif()
if( HAVE_SIGNAL_H )
# Avoid sigaltstack on Apple platforms, where backtrace() cannot handle it
# (rdar://7089625) and _Unwind_Backtrace is unusable because it cannot unwind
# past the signal handler after an assertion failure (rdar://29866587).
if( HAVE_SIGNAL_H AND NOT APPLE )
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
endif()
if( HAVE_SYS_UIO_H )
Expand Down

0 comments on commit 43d2cb1

Please sign in to comment.