From 51958b26c17d9d51ca5f7bb1ee52af34ef5f444b Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Sat, 16 Jan 2016 10:19:07 -0800 Subject: [PATCH 7/7] Remove override of raise(), abort(), and __assert_rtn() Lion (10.7) and newer versions of OS X implement abort() using pthread_kill(). Signed-off-by: Jeremy Huddleston Sequoia --- lib/Support/Unix/Signals.inc | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git llvm_release_38/lib/Support/Unix/Signals.inc macports_release_38/lib/Support/Unix/Signals.inc index 4d687b3..f2797a0 100644 --- llvm_release_38/lib/Support/Unix/Signals.inc +++ macports_release_38/lib/Support/Unix/Signals.inc @@ -411,42 +411,3 @@ void llvm::sys::PrintStackTraceOnErrorSignal(bool DisableCrashReporting) { } #endif } - - -/***/ - -// On Darwin, raise sends a signal to the main thread instead of the current -// thread. This has the unfortunate effect that assert() and abort() will end up -// bypassing our crash recovery attempts. We work around this for anything in -// the same linkage unit by just defining our own versions of the assert handler -// and abort. - -#if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES) - -#include -#include - -int raise(int sig) { - return pthread_kill(pthread_self(), sig); -} - -void __assert_rtn(const char *func, - const char *file, - int line, - const char *expr) { - if (func) - fprintf(stderr, "Assertion failed: (%s), function %s, file %s, line %d.\n", - expr, func, file, line); - else - fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n", - expr, file, line); - abort(); -} - -void abort() { - raise(SIGABRT); - usleep(1000); - __builtin_trap(); -} - -#endif -- 2.7.0