Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

stacktraces.cpp File Reference
#include <stacktraces.h>
#include <fs.h>
#include <tinyformat.h>
#include <random.h>
#include <streams.h>
#include <util.h>
#include <utilstrencodings.h>
#include <dash-config.h>
#include <mutex>
#include <map>
#include <string>
#include <vector>
#include <memory>
#include <thread>
#include <atomic>
#include <cxxabi.h>
#include <execinfo.h>
#include <unistd.h>
#include <signal.h>
#include <dlfcn.h>
#include <link.h>
#include <backtrace.h>
#include <string.h>
+ Include dependency graph for stacktraces.cpp:

Go to the source code of this file.

Classes

struct  stackframe_info
 
struct  crash_info_header
 
struct  crash_info
 

Functions

std::string DemangleSymbol (const std::string &name)
 
static std::atomic< bool > skipAbortSignal (false)
 
static ssize_t GetExeFileNameImpl (char *buf, size_t bufSize)
 
static std::string GetExeFileName ()
 
static void my_backtrace_error_callback (void *data, const char *msg, int errnum)
 
static backtrace_state * GetLibBacktraceState ()
 
static int dl_iterate_callback (struct dl_phdr_info *info, size_t s, void *data)
 
static uint64_t GetBaseAddress ()
 
static __attribute__ ((noinline)) std
 
static int my_backtrace_full_callback (void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
 
static std::vector< stackframe_infoGetStackFrameInfos (const std::vector< uint64_t > &stackframes)
 
static std::string GetCrashInfoStrNoDebugInfo (crash_info ci)
 
static std::string GetCrashInfoStr (const crash_info &ci, size_t spaces=2)
 
std::string GetCrashInfoStrFromSerializedStr (const std::string &ciStr)
 
static void PrintCrashInfo (const crash_info &ci)
 
static std::shared_ptr< std::vector< uint64_t > > GetExceptionStacktrace (const std::exception_ptr &e)
 
crash_info GetCrashInfoFromException (const std::exception_ptr &e)
 
std::string GetPrettyExceptionStr (const std::exception_ptr &e)
 
static void terminate_handler ()
 
void RegisterPrettyTerminateHander ()
 
static void HandlePosixSignal (int s)
 
void RegisterPrettySignalHandlers ()
 

Variables

static std::string g_exeFileName = GetExeFileName()
 
static std::string g_exeFileBaseName = fs::path(g_exeFileName).filename().string()
 

Function Documentation

◆ __attribute__()

static __attribute__ ( (noinline)  )
static

Definition at line 276 of file stacktraces.cpp.

References count.

◆ DemangleSymbol()

std::string DemangleSymbol ( const std::string &  name)

Definition at line 51 of file stacktraces.cpp.

References name.

Referenced by GetCrashInfoFromException(), and my_backtrace_full_callback().

◆ dl_iterate_callback()

static int dl_iterate_callback ( struct dl_phdr_info *  info,
size_t  s,
void *  data 
)
static

Definition at line 259 of file stacktraces.cpp.

Referenced by GetBaseAddress().

◆ GetBaseAddress()

static uint64_t GetBaseAddress ( )
static

◆ GetCrashInfoFromException()

◆ GetCrashInfoStr()

static std::string GetCrashInfoStr ( const crash_info ci,
size_t  spaces = 2 
)
static

◆ GetCrashInfoStrFromSerializedStr()

◆ GetCrashInfoStrNoDebugInfo()

◆ GetExceptionStacktrace()

static std::shared_ptr<std::vector<uint64_t> > GetExceptionStacktrace ( const std::exception_ptr &  e)
static

Definition at line 664 of file stacktraces.cpp.

Referenced by GetCrashInfoFromException().

◆ GetExeFileName()

static std::string GetExeFileName ( )
static

Definition at line 102 of file stacktraces.cpp.

References GetExeFileNameImpl().

◆ GetExeFileNameImpl()

static ssize_t GetExeFileNameImpl ( char *  buf,
size_t  bufSize 
)
static

Definition at line 73 of file stacktraces.cpp.

Referenced by GetExeFileName().

◆ GetLibBacktraceState()

static backtrace_state* GetLibBacktraceState ( )
static

Definition at line 125 of file stacktraces.cpp.

References g_exeFileName, and my_backtrace_error_callback().

Referenced by GetStackFrameInfos().

◆ GetPrettyExceptionStr()

std::string GetPrettyExceptionStr ( const std::exception_ptr &  e)

Definition at line 732 of file stacktraces.cpp.

References GetCrashInfoFromException(), and GetCrashInfoStr().

Referenced by PrintExceptionContinue().

◆ GetStackFrameInfos()

static std::vector<stackframe_info> GetStackFrameInfos ( const std::vector< uint64_t > &  stackframes)
static

◆ HandlePosixSignal()

◆ my_backtrace_error_callback()

static void my_backtrace_error_callback ( void *  data,
const char *  msg,
int  errnum 
)
static

Definition at line 120 of file stacktraces.cpp.

Referenced by GetLibBacktraceState(), and GetStackFrameInfos().

◆ my_backtrace_full_callback()

static int my_backtrace_full_callback ( void *  data,
uintptr_t  pc,
const char *  filename,
int  lineno,
const char *  function 
)
static

◆ PrintCrashInfo()

static void PrintCrashInfo ( const crash_info ci)
static

Definition at line 524 of file stacktraces.cpp.

References GetCrashInfoStr(), and LogPrintf.

Referenced by HandlePosixSignal(), and terminate_handler().

◆ RegisterPrettySignalHandlers()

void RegisterPrettySignalHandlers ( )

Definition at line 842 of file stacktraces.cpp.

References HandlePosixSignal().

Referenced by main().

◆ RegisterPrettyTerminateHander()

void RegisterPrettyTerminateHander ( )

Definition at line 762 of file stacktraces.cpp.

References terminate_handler().

Referenced by main().

◆ skipAbortSignal()

static std::atomic<bool> skipAbortSignal ( false  )
static

◆ terminate_handler()

Variable Documentation

◆ g_exeFileBaseName

std::string g_exeFileBaseName = fs::path(g_exeFileName).filename().string()
static

◆ g_exeFileName

std::string g_exeFileName = GetExeFileName()
static

Definition at line 117 of file stacktraces.cpp.

Referenced by GetLibBacktraceState().

Released under the MIT license