[PATCH] D58702: Enabled Backtraces with just ENABLE_BACKTRACES
Jason Mittertreiner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 26 17:14:47 PST 2019
jmittert created this revision.
jmittert added a reviewer: resistor.
Herald added subscribers: llvm-commits, kristina.
Herald added a project: LLVM.
Some platforms, e.g. Windows, support backtraces but don't have
BACKTRACE. Checking for BACKTRACE prevents Windows from having
backtraces.
Repository:
rL LLVM
https://reviews.llvm.org/D58702
Files:
lib/Support/PrettyStackTrace.cpp
Index: lib/Support/PrettyStackTrace.cpp
===================================================================
--- lib/Support/PrettyStackTrace.cpp
+++ lib/Support/PrettyStackTrace.cpp
@@ -33,7 +33,7 @@
// 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) && ENABLE_BACKTRACES
+#if 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
@@ -127,11 +127,11 @@
#endif
}
-// defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+// ENABLE_BACKTRACES
#endif
PrettyStackTraceEntry::PrettyStackTraceEntry() {
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
// Link ourselves.
NextEntry = PrettyStackTraceHead;
PrettyStackTraceHead = this;
@@ -139,7 +139,7 @@
}
PrettyStackTraceEntry::~PrettyStackTraceEntry() {
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
assert(PrettyStackTraceHead == this &&
"Pretty stack trace entry destruction is out of order");
PrettyStackTraceHead = NextEntry;
@@ -174,7 +174,7 @@
OS << '\n';
}
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
static bool RegisterCrashPrinter() {
sys::AddSignalHandler(CrashHandler, nullptr);
return false;
@@ -182,7 +182,7 @@
#endif
void llvm::EnablePrettyStackTrace() {
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
// The first time this is called, we register the crash printer.
static bool HandlerRegistered = RegisterCrashPrinter();
(void)HandlerRegistered;
@@ -190,7 +190,7 @@
}
const void *llvm::SavePrettyStackState() {
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
return PrettyStackTraceHead;
#else
return nullptr;
@@ -198,7 +198,7 @@
}
void llvm::RestorePrettyStackState(const void *Top) {
-#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES
+#if ENABLE_BACKTRACES
PrettyStackTraceHead =
static_cast<PrettyStackTraceEntry *>(const_cast<void *>(Top));
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58702.188483.patch
Type: text/x-patch
Size: 2225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190227/2a777f74/attachment.bin>
More information about the llvm-commits
mailing list