mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-21 13:33:26 +00:00
Convert ENABLE_BACKTRACES into a 0/1 definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e683f12dc
commit
2bf78b4d6c
@ -7,8 +7,8 @@
|
||||
/* Bug report URL. */
|
||||
#define BUG_REPORT_URL "${BUG_REPORT_URL}"
|
||||
|
||||
/* Define if you want backtraces on crash */
|
||||
#cmakedefine ENABLE_BACKTRACES
|
||||
/* Define to 1 to enable backtraces, and to 0 otherwise. */
|
||||
#cmakedefine01 ENABLE_BACKTRACES
|
||||
|
||||
/* Define to enable crash overrides */
|
||||
#cmakedefine ENABLE_CRASH_OVERRIDES
|
||||
|
@ -32,7 +32,7 @@ using namespace llvm;
|
||||
// If backtrace support is not enabled, compile out support for pretty stack
|
||||
// traces. This has the secondary effect of not requiring thread local storage
|
||||
// when backtrace support is disabled.
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
|
||||
// We need a thread local pointer to manage the stack of our stack trace
|
||||
// objects, but we *really* cannot tolerate destructors running and do not want
|
||||
@ -122,11 +122,11 @@ static void CrashHandler(void *) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
// defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
#endif
|
||||
|
||||
PrettyStackTraceEntry::PrettyStackTraceEntry() {
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
// Link ourselves.
|
||||
NextEntry = PrettyStackTraceHead;
|
||||
PrettyStackTraceHead = this;
|
||||
@ -134,7 +134,7 @@ PrettyStackTraceEntry::PrettyStackTraceEntry() {
|
||||
}
|
||||
|
||||
PrettyStackTraceEntry::~PrettyStackTraceEntry() {
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
assert(PrettyStackTraceHead == this &&
|
||||
"Pretty stack trace entry destruction is out of order");
|
||||
PrettyStackTraceHead = NextEntry;
|
||||
@ -153,7 +153,7 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
|
||||
OS << '\n';
|
||||
}
|
||||
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
static bool RegisterCrashPrinter() {
|
||||
sys::AddSignalHandler(CrashHandler, nullptr);
|
||||
return false;
|
||||
@ -161,7 +161,7 @@ static bool RegisterCrashPrinter() {
|
||||
#endif
|
||||
|
||||
void llvm::EnablePrettyStackTrace() {
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
// The first time this is called, we register the crash printer.
|
||||
static bool HandlerRegistered = RegisterCrashPrinter();
|
||||
(void)HandlerRegistered;
|
||||
@ -169,7 +169,7 @@ void llvm::EnablePrettyStackTrace() {
|
||||
}
|
||||
|
||||
const void *llvm::SavePrettyStackState() {
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
return PrettyStackTraceHead;
|
||||
#else
|
||||
return nullptr;
|
||||
@ -177,7 +177,7 @@ const void *llvm::SavePrettyStackState() {
|
||||
}
|
||||
|
||||
void llvm::RestorePrettyStackState(const void *Top) {
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
|
||||
PrettyStackTraceHead =
|
||||
static_cast<PrettyStackTraceEntry *>(const_cast<void *>(Top));
|
||||
#endif
|
||||
|
@ -298,7 +298,7 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
|
||||
RegisterHandlers();
|
||||
}
|
||||
|
||||
#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) && HAVE_LINK_H && \
|
||||
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && HAVE_LINK_H && \
|
||||
(defined(__linux__) || defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || defined(__NetBSD__))
|
||||
struct DlIteratePhdrData {
|
||||
@ -353,9 +353,9 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth,
|
||||
StringSaver &StrPool) {
|
||||
return false;
|
||||
}
|
||||
#endif // defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) && ...
|
||||
#endif // defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && ...
|
||||
|
||||
#if defined(ENABLE_BACKTRACES) && defined(HAVE__UNWIND_BACKTRACE)
|
||||
#if ENABLE_BACKTRACES && defined(HAVE__UNWIND_BACKTRACE)
|
||||
static int unwindBacktrace(void **StackTrace, int MaxEntries) {
|
||||
if (MaxEntries < 0)
|
||||
return 0;
|
||||
@ -393,7 +393,7 @@ static int unwindBacktrace(void **StackTrace, int MaxEntries) {
|
||||
// On glibc systems we have the 'backtrace' function, which works nicely, but
|
||||
// doesn't demangle symbols.
|
||||
void llvm::sys::PrintStackTrace(raw_ostream &OS) {
|
||||
#if defined(ENABLE_BACKTRACES)
|
||||
#if ENABLE_BACKTRACES
|
||||
static void *StackTrace[256];
|
||||
int depth = 0;
|
||||
#if defined(HAVE_BACKTRACE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user