LLVM  11.0.0git
Classes | Functions | Variables
Signals.cpp File Reference
#include "llvm/Support/Signals.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
#include <vector>
#include "Unix/Signals.inc"
Include dependency graph for Signals.cpp:

Go to the source code of this file.


struct  CallbackAndCookie


static void insertSignalHandler (sys::SignalHandlerCallback FnPtr, void *Cookie)
static bool findModulesAndOffsets (void **StackTrace, int Depth, const char **Modules, intptr_t *Offsets, const char *MainExecutableName, StringSaver &StrPool)
static FormattedNumber format_ptr (void *PC)
 Format a pointer value as hexadecimal. More...
static LLVM_ATTRIBUTE_USED bool printSymbolizedStackTrace (StringRef Argv0, void **StackTrace, int Depth, llvm::raw_ostream &OS)
 Helper that launches llvm-symbolizer and symbolizes a backtrace. More...


static bool DisableSymbolicationFlag = false
static cl::opt< bool, trueDisableSymbolication ("disable-symbolication", cl::desc("Disable symbolizing crash backtraces."), cl::location(DisableSymbolicationFlag), cl::Hidden)
static constexpr size_t MaxSignalHandlerCallbacks = 8
static CallbackAndCookie CallBacksToRun [MaxSignalHandlerCallbacks]

Function Documentation

◆ findModulesAndOffsets()

static bool findModulesAndOffsets ( void **  StackTrace,
int  Depth,
const char **  Modules,
intptr_t Offsets,
const char MainExecutableName,
StringSaver StrPool 

◆ format_ptr()

static FormattedNumber format_ptr ( void *  PC)

Format a pointer value as hexadecimal.

Zero pad it out so its always the same width.

Definition at line 98 of file Signals.cpp.

References llvm::format_hex(), and LLVM_ATTRIBUTE_USED.

Referenced by printSymbolizedStackTrace().

◆ insertSignalHandler()

static void insertSignalHandler ( sys::SignalHandlerCallback  FnPtr,
void *  Cookie 

◆ printSymbolizedStackTrace()

static LLVM_ATTRIBUTE_USED bool printSymbolizedStackTrace ( StringRef  Argv0,
void **  StackTrace,
int  Depth,
llvm::raw_ostream OS 

Variable Documentation

◆ CallBacksToRun

Definition at line 57 of file Signals.cpp.

◆ DisableSymbolication

cl::opt<bool, true> DisableSymbolication("disable-symbolication", cl::desc("Disable symbolizing crash backtraces."), cl::location(DisableSymbolicationFlag), cl::Hidden)

◆ DisableSymbolicationFlag

bool DisableSymbolicationFlag = false

Definition at line 41 of file Signals.cpp.

◆ MaxSignalHandlerCallbacks

constexpr size_t MaxSignalHandlerCallbacks = 8

Definition at line 56 of file Signals.cpp.

Referenced by insertSignalHandler(), and llvm::sys::RunSignalHandlers().