18 #include "llvm/Config/config.h"
24 #ifdef HAVE_CRASHREPORTERCLIENT_H
25 #include <CrashReporterClient.h>
33 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
46 OS << NextID <<
".\t";
61 OS <<
"Stack dump:\n";
68 #if defined (__APPLE__) && HAVE_CRASHREPORTERCLIENT_H
72 CRASH_REPORTER_CLIENT_HIDDEN
73 struct crashreporter_annotations_t gCRAnnotations
74 __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION)))
75 = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
77 #elif defined (__APPLE__) && HAVE_CRASHREPORTER_INFO
78 static const char *__crashreporter_info__ = 0;
79 asm(
".desc ___crashreporter_info__, 0x10");
98 if (!TmpStr.
empty()) {
99 #ifdef HAVE_CRASHREPORTERCLIENT_H
101 (void)CRSetCrashLogMessage(std::string(TmpStr.
str()).
c_str());
102 #elif HAVE_CRASHREPORTER_INFO
103 __crashreporter_info__ = strdup(std::string(TmpStr.
str()).
c_str());
115 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
123 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
125 "Pretty stack trace entry destruction is out of order");
135 OS <<
"Program arguments: ";
137 for (
unsigned i = 0, e = ArgC; i != e; ++i)
138 OS << ArgV[i] <<
' ';
142 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
150 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
153 (void)HandlerRegistered;
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
A raw_ostream that writes to an SmallVector or SmallString.
This class provides an abstraction for a timeout around an operation that must complete in a given am...
void EnablePrettyStackTrace()
const PrettyStackTraceEntry * getNextEntry() const
getNextEntry - Return the next entry in the list of frames.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
#define LLVM_THREAD_LOCAL
LLVM_THREAD_LOCAL
static LLVM_THREAD_LOCAL const PrettyStackTraceEntry * PrettyStackTraceHead
void LLVMEnablePrettyStackTrace()
Enable LLVM's built-in stack trace code.
static void PrintCurStackTrace(raw_ostream &OS)
PrintCurStackTrace - Print the current stack trace to the specified stream.
PrettyStackTraceEntry - This class is used to represent a frame of the "pretty" stack trace that is d...
virtual ~PrettyStackTraceEntry()
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
static unsigned PrintStack(const PrettyStackTraceEntry *Entry, raw_ostream &OS)
static bool RegisterCrashPrinter()
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
StringRef str() const
Explicit conversion to StringRef.
virtual void print(raw_ostream &OS) const =0
print - Emit information about this stack frame to OS.
static void CrashHandler(void *)
CrashHandler - This callback is run if a fatal signal is delivered to the process, it prints the pretty stack trace.
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
__attribute__((weak)) dfsan_label dfsan_create_label(const char *desc
This class implements an extremely fast bulk output stream that can only output to a stream...
void AddSignalHandler(void(*FnPtr)(void *), void *Cookie)
AddSignalHandler - Add a function to be called when an abort/kill signal is delivered to the process...