LLVM 20.0.0git
Classes | Functions | Variables
Signals.cpp File Reference
#include "llvm/Support/Signals.h"
#include "DebugOptions.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/FormatVariadic.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <cmath>
#include <vector>
#include "Unix/Signals.inc"

Go to the source code of this file.

Classes

struct  CallbackAndCookie
 

Functions

static std::array< CallbackAndCookie, MaxSignalHandlerCallbacks > & CallBacksToRun ()
 
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.
 
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.
 
static bool printMarkupContext (raw_ostream &OS, const char *MainExecutableName)
 
static LLVM_ATTRIBUTE_USED bool printMarkupStackTrace (StringRef Argv0, void **StackTrace, int Depth, raw_ostream &OS)
 

Variables

static bool DisableSymbolicationFlag = false
 
static ManagedStatic< std::string > CrashDiagnosticsDirectory
 
constexpr char DisableSymbolizationEnv [] = "LLVM_DISABLE_SYMBOLIZATION"
 
constexpr char LLVMSymbolizerPathEnv [] = "LLVM_SYMBOLIZER_PATH"
 
constexpr char EnableSymbolizerMarkupEnv [] = "LLVM_ENABLE_SYMBOLIZER_MARKUP"
 
static constexpr size_t MaxSignalHandlerCallbacks = 8
 

Function Documentation

◆ CallBacksToRun()

static std::array< CallbackAndCookie, MaxSignalHandlerCallbacks > & CallBacksToRun ( )
static

Definition at line 92 of file Signals.cpp.

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

◆ findModulesAndOffsets()

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

◆ format_ptr()

static FormattedNumber format_ptr ( void *  PC)
static

Format a pointer value as hexadecimal.

Zero pad it out so its always the same width.

Definition at line 134 of file Signals.cpp.

References llvm::format_hex().

Referenced by printSymbolizedStackTrace().

◆ insertSignalHandler()

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

◆ printMarkupContext()

static bool printMarkupContext ( raw_ostream OS,
const char MainExecutableName 
)
static

Referenced by printMarkupStackTrace().

◆ printMarkupStackTrace()

static LLVM_ATTRIBUTE_USED bool printMarkupStackTrace ( StringRef  Argv0,
void **  StackTrace,
int  Depth,
raw_ostream OS 
)
static

◆ printSymbolizedStackTrace()

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

Variable Documentation

◆ CrashDiagnosticsDirectory

ManagedStatic<std::string> CrashDiagnosticsDirectory
static

Definition at line 45 of file Signals.cpp.

◆ DisableSymbolicationFlag

bool DisableSymbolicationFlag = false
static

Definition at line 44 of file Signals.cpp.

Referenced by printSymbolizedStackTrace().

◆ DisableSymbolizationEnv

constexpr char DisableSymbolizationEnv[] = "LLVM_DISABLE_SYMBOLIZATION"
constexpr

Definition at line 73 of file Signals.cpp.

Referenced by printSymbolizedStackTrace().

◆ EnableSymbolizerMarkupEnv

constexpr char EnableSymbolizerMarkupEnv[] = "LLVM_ENABLE_SYMBOLIZER_MARKUP"
constexpr

Definition at line 75 of file Signals.cpp.

Referenced by printMarkupStackTrace().

◆ LLVMSymbolizerPathEnv

constexpr char LLVMSymbolizerPathEnv[] = "LLVM_SYMBOLIZER_PATH"
constexpr

Definition at line 74 of file Signals.cpp.

Referenced by printSymbolizedStackTrace().

◆ MaxSignalHandlerCallbacks

constexpr size_t MaxSignalHandlerCallbacks = 8
staticconstexpr

Definition at line 87 of file Signals.cpp.