mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
[Support] revert previous commit r270643
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270670 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4f4018ce2c
commit
9f618c8791
@ -490,3 +490,42 @@ 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 <signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user