[PATCH] D28265: disable sigaltstack on Apple platforms

Bob Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 10:21:31 PST 2017


bob.wilson added a comment.

Yes, of course you are right that this is not ideal. It's not about avoiding crashes though -- the issue is that the backtraces we dump out after an assertion failure are useless since they stop at the signal handler.

Your comment prompted me to look a little deeper, and I discovered that the _Unwind_Backtrace issue is not specific to sigaltstack. We first try to use the backtrace() function, and if you're not using sigaltstack, that succeeds and we never try using _Unwind_Backtrace. If I modify the code to skip trying backtrace(), I consistently get stack traces that stop at the signal handler after an assertion failure. I filed a bug report about that for libunwind (rdar://problem/29866587). As I mentioned earlier with r286851, I also filed a bug report about backtrace() not working with sigaltstack, but I didn't get the impression that was being treated as a high priority.

Even if we get a fix for libunwind or backtrace (and I don't know if/when that might happen), it will take a while to get it released in macOS and we should wait a year or so beyond that so that the majority of LLVM developers will have updated to get the fix. In the meantime, we need this as a workaround. I should also revert my change in r286851 until _Unwind_Backtrace works reliably on Darwin.


https://reviews.llvm.org/D28265





More information about the llvm-commits mailing list