2019-02-03 21:30:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#if USE_UNWIND
|
|
|
|
#define UNW_LOCAL_ONLY
|
|
|
|
#include <libunwind.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
// ucontext is not available without _XOPEN_SOURCE
|
|
|
|
#define _XOPEN_SOURCE
|
|
|
|
#endif
|
|
|
|
#include <ucontext.h>
|
|
|
|
|
|
|
|
|
|
|
|
std::string signalToErrorMessage(int sig, siginfo_t & info, ucontext_t & context);
|
|
|
|
|
|
|
|
void * getCallerAddress(ucontext_t & context);
|
|
|
|
|
|
|
|
std::vector<void *> getBacktraceFrames(ucontext_t & context);
|
|
|
|
|
2019-02-10 03:10:07 +00:00
|
|
|
std::string backtraceFramesToString(const std::vector<void *> & frames, const std::string & delimiter = "");
|