summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Support/Signals.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
committerpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
commit31eb748944903b7f4f38afda9851951ca9dfc1ae (patch)
tree9b95b6ea45d0874d75eb05b90c0840e191416439 /gnu/llvm/lib/Support/Signals.cpp
parentDon't try to handle IPv4-compatible IPv6 addresses (diff)
downloadwireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.tar.xz
wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.zip
Import LLVM 5.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/Support/Signals.cpp')
-rw-r--r--gnu/llvm/lib/Support/Signals.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/gnu/llvm/lib/Support/Signals.cpp b/gnu/llvm/lib/Support/Signals.cpp
index e5e38f59c04..256a22dee87 100644
--- a/gnu/llvm/lib/Support/Signals.cpp
+++ b/gnu/llvm/lib/Support/Signals.cpp
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/Signals.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/config.h"
@@ -23,19 +24,23 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Program.h"
-#include "llvm/Support/Signals.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Options.h"
#include <vector>
-namespace llvm {
-using namespace sys;
-
//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only TRULY operating system
//=== independent code.
//===----------------------------------------------------------------------===//
+using namespace llvm;
+
+static cl::opt<bool>
+ DisableSymbolication("disable-symbolication",
+ cl::desc("Disable symbolizing crash backtraces."),
+ cl::init(false), cl::Hidden);
+
static ManagedStatic<std::vector<std::pair<void (*)(void *), void *>>>
CallBacksToRun;
void sys::RunSignalHandlers() {
@@ -45,9 +50,6 @@ void sys::RunSignalHandlers() {
I.first(I.second);
CallBacksToRun->clear();
}
-}
-
-using namespace llvm;
static bool findModulesAndOffsets(void **StackTrace, int Depth,
const char **Modules, intptr_t *Offsets,
@@ -71,6 +73,9 @@ static bool printSymbolizedStackTrace(StringRef Argv0,
static bool printSymbolizedStackTrace(StringRef Argv0,
void **StackTrace, int Depth,
llvm::raw_ostream &OS) {
+ if (DisableSymbolication)
+ return false;
+
// Don't recursively invoke the llvm-symbolizer binary.
if (Argv0.find("llvm-symbolizer") != std::string::npos)
return false;