2 Commits

Author SHA1 Message Date
dd15bb2205 updated build system 2024-07-27 15:54:01 -05:00
4b53b5544f updated build system 2024-07-27 15:53:45 -05:00
11 changed files with 93 additions and 63 deletions

View File

@ -122,6 +122,7 @@ endif()
-DPROJECT_COPYRIGHT=${PROJECT_COPYRIGHT} -DPROJECT_COPYRIGHT=${PROJECT_COPYRIGHT}
-DPROJECT_DESC=${PROJECT_DESC} -DPROJECT_DESC=${PROJECT_DESC}
-DPROJECT_DIST_DIR=${PROJECT_DIST_DIR} -DPROJECT_DIST_DIR=${PROJECT_DIST_DIR}
-DPROJECT_ENABLE_BACKWARD_CPP=${PROJECT_ENABLE_BACKWARD_CPP}
-DPROJECT_ENABLE_BOOST=${PROJECT_ENABLE_BOOST} -DPROJECT_ENABLE_BOOST=${PROJECT_ENABLE_BOOST}
-DPROJECT_ENABLE_CPP_HTTPLIB=${PROJECT_ENABLE_CPP_HTTPLIB} -DPROJECT_ENABLE_CPP_HTTPLIB=${PROJECT_ENABLE_CPP_HTTPLIB}
-DPROJECT_ENABLE_CURL=${PROJECT_ENABLE_CURL} -DPROJECT_ENABLE_CURL=${PROJECT_ENABLE_CURL}

View File

@ -6,6 +6,7 @@ include(cmake/libraries/openssl.cmake)
include(cmake/libraries/boost.cmake) include(cmake/libraries/boost.cmake)
include(cmake/libraries/backward_cpp.cmake)
include(cmake/libraries/cpp_httplib.cmake) include(cmake/libraries/cpp_httplib.cmake)
include(cmake/libraries/curl.cmake) include(cmake/libraries/curl.cmake)
include(cmake/libraries/fuse.cmake) include(cmake/libraries/fuse.cmake)

View File

@ -0,0 +1,7 @@
if(PROJECT_ENABLE_BACKWARD_CPP AND PROJECT_BUILD)
add_definitions(-DPROJECT_ENABLE_BACKWARD_CPP)
if(PROJECT_IS_MINGW)
link_libraries(msvcr90)
endif()
endif()

View File

@ -1,3 +1,4 @@
option(PROJECT_ENABLE_BACKWARD_CPP "Enable backward-cpp" ON)
option(PROJECT_ENABLE_BOOST "Enable boost libraries" ON) option(PROJECT_ENABLE_BOOST "Enable boost libraries" ON)
option(PROJECT_ENABLE_CPP_HTTPLIB "Enable cpp-httplib" ON) option(PROJECT_ENABLE_CPP_HTTPLIB "Enable cpp-httplib" ON)
option(PROJECT_ENABLE_CURL "Enable curl library" ON) option(PROJECT_ENABLE_CURL "Enable curl library" ON)

View File

@ -19,6 +19,7 @@ PROJECT_APP_LIST=(${PROJECT_NAME})
PROJECT_PRIVATE_KEY=${DEVELOPER_PRIVATE_KEY} PROJECT_PRIVATE_KEY=${DEVELOPER_PRIVATE_KEY}
PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY} PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY}
PROJECT_ENABLE_BACKWARD_CPP=ON
PROJECT_ENABLE_BOOST=ON PROJECT_ENABLE_BOOST=ON
PROJECT_ENABLE_CPP_HTTPLIB=ON PROJECT_ENABLE_CPP_HTTPLIB=ON
PROJECT_ENABLE_CURL=ON PROJECT_ENABLE_CURL=ON
@ -33,6 +34,7 @@ PROJECT_ENABLE_STDUUID=ON
PROJECT_ENABLE_TESTING=ON PROJECT_ENABLE_TESTING=ON
PROJECT_ENABLE_WINFSP=ON PROJECT_ENABLE_WINFSP=ON
PROJECT_KEEP_BACKWARD_CPP=1
PROJECT_STATIC_LINK=ON PROJECT_STATIC_LINK=ON
PROJECT_MINGW64_COPY_DEPENDENCIES+=() PROJECT_MINGW64_COPY_DEPENDENCIES+=()

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
#include "backward.hpp" #include "backward.hpp"
#endif #endif
@ -32,7 +32,7 @@
using namespace repertory; using namespace repertory;
auto main(int argc, char **argv) -> int { auto main(int argc, char **argv) -> int {
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
static backward::SignalHandling sh; static backward::SignalHandling sh;
#endif #endif

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
#include "backward.hpp" #include "backward.hpp"
#endif #endif
@ -36,7 +36,7 @@ std::size_t PROVIDER_INDEX{0U};
#endif // _WIN32 #endif // _WIN32
auto main(int argc, char **argv) -> int { auto main(int argc, char **argv) -> int {
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
static backward::SignalHandling sh; static backward::SignalHandling sh;
#endif #endif

View File

@ -202,6 +202,7 @@ fi
if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then
PROJECT_BUILD_SHARED_LIBS=OFF PROJECT_BUILD_SHARED_LIBS=OFF
PROJECT_ENABLE_BACKWARD_CPP=OFF
else else
PROJECT_BUILD_SHARED_LIBS=ON PROJECT_BUILD_SHARED_LIBS=ON
fi fi

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
PROJECT_LIBRARIES=( PROJECT_LIBRARIES=(
BACKWARD_CPP
BOOST BOOST
CPP_HTTPLIB CPP_HTTPLIB
CURL CURL
@ -17,6 +18,7 @@ PROJECT_LIBRARIES=(
) )
declare -A PROJECT_CLEANUP declare -A PROJECT_CLEANUP
PROJECT_CLEANUP[BACKWARD_CPP]="include/backward.hpp:src/backward.cpp"
PROJECT_CLEANUP[BOOST]="boost_*" PROJECT_CLEANUP[BOOST]="boost_*"
PROJECT_CLEANUP[CPP_HTTPLIB]="cpp-httplib-*" PROJECT_CLEANUP[CPP_HTTPLIB]="cpp-httplib-*"
PROJECT_CLEANUP[CURL]="curl-*" PROJECT_CLEANUP[CURL]="curl-*"

View File

@ -1,3 +1,4 @@
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
/* /*
* backward.hpp * backward.hpp
* Copyright 2013 Google Inc. All Rights Reserved. * Copyright 2013 Google Inc. All Rights Reserved.
@ -81,17 +82,17 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <exception>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <iterator>
#include <limits> #include <limits>
#include <new> #include <new>
#include <sstream> #include <sstream>
#include <streambuf> #include <streambuf>
#include <string> #include <string>
#include <vector> #include <vector>
#include <exception>
#include <iterator>
#if defined(BACKWARD_SYSTEM_LINUX) #if defined(BACKWARD_SYSTEM_LINUX)
@ -211,7 +212,7 @@
#else #else
#include <link.h> #include <link.h>
#endif #endif
#if defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \ #if defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \
defined(__POWERPC__) defined(__POWERPC__)
// Linux kernel header required for the struct pt_regs definition // Linux kernel header required for the struct pt_regs definition
// to access the NIP (Next Instruction Pointer) register value // to access the NIP (Next Instruction Pointer) register value
@ -507,11 +508,17 @@ typedef pdb_symbol current;
namespace details { namespace details {
template <typename T> struct rm_ptr { typedef T type; }; template <typename T> struct rm_ptr {
typedef T type;
};
template <typename T> struct rm_ptr<T *> { typedef T type; }; template <typename T> struct rm_ptr<T *> {
typedef T type;
};
template <typename T> struct rm_ptr<const T *> { typedef const T type; }; template <typename T> struct rm_ptr<const T *> {
typedef const T type;
};
template <typename R, typename T, R (*F)(T)> struct deleter { template <typename R, typename T, R (*F)(T)> struct deleter {
template <typename U> void operator()(U &ptr) const { (*F)(ptr); } template <typename U> void operator()(U &ptr) const { (*F)(ptr); }
@ -521,7 +528,7 @@ template <typename T> struct default_delete {
void operator()(T &ptr) const { delete ptr; } void operator()(T &ptr) const { delete ptr; }
}; };
template <typename T, typename Deleter = deleter<void, void *, &::free> > template <typename T, typename Deleter = deleter<void, void *, &::free>>
class handle { class handle {
struct dummy; struct dummy;
T _val; T _val;
@ -1134,7 +1141,7 @@ public:
NOINLINE NOINLINE
size_t load_here(size_t depth = 32, void *context = nullptr, size_t load_here(size_t depth = 32, void *context = nullptr,
void *error_addr = nullptr) { void *error_addr = nullptr) {
set_context(static_cast<CONTEXT*>(context)); set_context(static_cast<CONTEXT *>(context));
set_error_addr(error_addr); set_error_addr(error_addr);
CONTEXT localCtx; // used when no context is provided CONTEXT localCtx; // used when no context is provided
@ -1228,7 +1235,7 @@ class TraceResolverImplBase {
public: public:
virtual ~TraceResolverImplBase() {} virtual ~TraceResolverImplBase() {}
virtual void load_addresses(void *const*addresses, int address_count) { virtual void load_addresses(void *const *addresses, int address_count) {
(void)addresses; (void)addresses;
(void)address_count; (void)address_count;
} }
@ -1252,7 +1259,8 @@ template <typename TAG> class TraceResolverImpl;
#ifdef BACKWARD_SYSTEM_UNKNOWN #ifdef BACKWARD_SYSTEM_UNKNOWN
template <> class TraceResolverImpl<system_tag::unknown_tag> template <>
class TraceResolverImpl<system_tag::unknown_tag>
: public TraceResolverImplBase {}; : public TraceResolverImplBase {};
#endif #endif
@ -1327,7 +1335,7 @@ template <>
class TraceResolverLinuxImpl<trace_resolver_tag::backtrace_symbol> class TraceResolverLinuxImpl<trace_resolver_tag::backtrace_symbol>
: public TraceResolverLinuxBase { : public TraceResolverLinuxBase {
public: public:
void load_addresses(void *const*addresses, int address_count) override { void load_addresses(void *const *addresses, int address_count) override {
if (address_count == 0) { if (address_count == 0) {
return; return;
} }
@ -1428,7 +1436,7 @@ public:
// this is preferable. Libbfd will search for stripped debug // this is preferable. Libbfd will search for stripped debug
// symbols in the same directory. // symbols in the same directory.
fobj = load_object_with_bfd(trace.object_filename); fobj = load_object_with_bfd(trace.object_filename);
} else{ } else {
// The original object file was *deleted*! The only hope is // The original object file was *deleted*! The only hope is
// that the debug symbols are either inside the shared // that the debug symbols are either inside the shared
// object file, or are in the same directory, and this is // object file, or are in the same directory, and this is
@ -1559,7 +1567,7 @@ private:
bool _bfd_loaded; bool _bfd_loaded;
typedef details::handle<bfd *, typedef details::handle<bfd *,
details::deleter<bfd_boolean, bfd *, &bfd_close> > details::deleter<bfd_boolean, bfd *, &bfd_close>>
bfd_handle_t; bfd_handle_t;
typedef details::handle<asymbol **> bfd_symtab_t; typedef details::handle<asymbol **> bfd_symtab_t;
@ -1867,7 +1875,7 @@ public:
} }
#endif #endif
//#define BACKWARD_I_DO_NOT_RECOMMEND_TO_ENABLE_THIS_HORRIBLE_PIECE_OF_CODE // #define BACKWARD_I_DO_NOT_RECOMMEND_TO_ENABLE_THIS_HORRIBLE_PIECE_OF_CODE
#ifdef BACKWARD_I_DO_NOT_RECOMMEND_TO_ENABLE_THIS_HORRIBLE_PIECE_OF_CODE #ifdef BACKWARD_I_DO_NOT_RECOMMEND_TO_ENABLE_THIS_HORRIBLE_PIECE_OF_CODE
if (!cudie) { if (!cudie) {
// If it's still not enough, lets dive deeper in the shit, and try // If it's still not enough, lets dive deeper in the shit, and try
@ -1931,9 +1939,9 @@ public:
} }
private: private:
typedef details::handle<Dwfl *, details::deleter<void, Dwfl *, &dwfl_end> > typedef details::handle<Dwfl *, details::deleter<void, Dwfl *, &dwfl_end>>
dwfl_handle_t; dwfl_handle_t;
details::handle<Dwfl_Callbacks *, details::default_delete<Dwfl_Callbacks *> > details::handle<Dwfl_Callbacks *, details::default_delete<Dwfl_Callbacks *>>
_dwfl_cb; _dwfl_cb;
dwfl_handle_t _dwfl_handle; dwfl_handle_t _dwfl_handle;
bool _dwfl_handle_initialized; bool _dwfl_handle_initialized;
@ -2255,14 +2263,14 @@ public:
private: private:
bool _dwarf_loaded; bool _dwarf_loaded;
typedef details::handle<int, details::deleter<int, int, &::close> > typedef details::handle<int, details::deleter<int, int, &::close>>
dwarf_file_t; dwarf_file_t;
typedef details::handle<Elf *, details::deleter<int, Elf *, &elf_end> > typedef details::handle<Elf *, details::deleter<int, Elf *, &elf_end>>
dwarf_elf_t; dwarf_elf_t;
typedef details::handle<Dwarf_Debug, typedef details::handle<Dwarf_Debug,
details::deleter<int, Dwarf_Debug, &close_dwarf> > details::deleter<int, Dwarf_Debug, &close_dwarf>>
dwarf_handle_t; dwarf_handle_t;
typedef std::map<Dwarf_Addr, int> die_linemap_t; typedef std::map<Dwarf_Addr, int> die_linemap_t;
@ -3349,9 +3357,10 @@ private:
char **srcfiles = 0; char **srcfiles = 0;
Dwarf_Signed file_count = 0; Dwarf_Signed file_count = 0;
if (dwarf_srcfiles(cu_die, &srcfiles, &file_count, &error) == DW_DLV_OK) { if (dwarf_srcfiles(cu_die, &srcfiles, &file_count, &error) == DW_DLV_OK) {
if (file_count > 0 && file_index <= static_cast<Dwarf_Unsigned>(file_count)) { if (file_count > 0 &&
file_index <= static_cast<Dwarf_Unsigned>(file_count)) {
file = std::string(srcfiles[file_index - 1]); file = std::string(srcfiles[file_index - 1]);
} }
// Deallocate all strings! // Deallocate all strings!
for (int i = 0; i < file_count; ++i) { for (int i = 0; i < file_count; ++i) {
@ -3488,7 +3497,7 @@ template <>
class TraceResolverDarwinImpl<trace_resolver_tag::backtrace_symbol> class TraceResolverDarwinImpl<trace_resolver_tag::backtrace_symbol>
: public TraceResolverImplBase { : public TraceResolverImplBase {
public: public:
void load_addresses(void *const*addresses, int address_count) override { void load_addresses(void *const *addresses, int address_count) override {
if (address_count == 0) { if (address_count == 0) {
return; return;
} }
@ -3605,7 +3614,8 @@ public:
} }
}; };
template <> class TraceResolverImpl<system_tag::windows_tag> template <>
class TraceResolverImpl<system_tag::windows_tag>
: public TraceResolverImplBase { : public TraceResolverImplBase {
public: public:
TraceResolverImpl() { TraceResolverImpl() {
@ -3619,13 +3629,13 @@ public:
DWORD symOptions = SymGetOptions(); DWORD symOptions = SymGetOptions();
symOptions |= SYMOPT_LOAD_LINES | SYMOPT_UNDNAME; symOptions |= SYMOPT_LOAD_LINES | SYMOPT_UNDNAME;
SymSetOptions(symOptions); SymSetOptions(symOptions);
EnumProcessModules(process, &module_handles[0], EnumProcessModules(
static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), process, &module_handles[0],
&cbNeeded); static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), &cbNeeded);
module_handles.resize(cbNeeded / sizeof(HMODULE)); module_handles.resize(cbNeeded / sizeof(HMODULE));
EnumProcessModules(process, &module_handles[0], EnumProcessModules(
static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), process, &module_handles[0],
&cbNeeded); static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), &cbNeeded);
std::transform(module_handles.begin(), module_handles.end(), std::transform(module_handles.begin(), module_handles.end(),
std::back_inserter(modules), get_mod_info(process)); std::back_inserter(modules), get_mod_info(process));
void *base = modules[0].base_address; void *base = modules[0].base_address;
@ -3652,14 +3662,14 @@ public:
if (!SymFromAddr(process, (ULONG64)t.addr, &displacement, &sym.sym)) { if (!SymFromAddr(process, (ULONG64)t.addr, &displacement, &sym.sym)) {
// TODO: error handling everywhere // TODO: error handling everywhere
char* lpMsgBuf; char *lpMsgBuf;
DWORD dw = GetLastError(); DWORD dw = GetLastError();
if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(char*)&lpMsgBuf, 0, NULL)) { (char *)&lpMsgBuf, 0, NULL)) {
std::fprintf(stderr, "%s\n", lpMsgBuf); std::fprintf(stderr, "%s\n", lpMsgBuf);
LocalFree(lpMsgBuf); LocalFree(lpMsgBuf);
} }
@ -3698,7 +3708,7 @@ class TraceResolver : public TraceResolverImpl<system_tag::current_tag> {};
class SourceFile { class SourceFile {
public: public:
typedef std::vector<std::pair<unsigned, std::string> > lines_t; typedef std::vector<std::pair<unsigned, std::string>> lines_t;
SourceFile() {} SourceFile() {}
SourceFile(const std::string &path) { SourceFile(const std::string &path) {
@ -3809,15 +3819,16 @@ public:
} }
#endif #endif
// Allow adding to paths gotten from BACKWARD_CXX_SOURCE_PREFIXES after loading the // Allow adding to paths gotten from BACKWARD_CXX_SOURCE_PREFIXES after
// library; this can be useful when the library is loaded when the locations are unknown // loading the library; this can be useful when the library is loaded when the
// Warning: Because this edits the static paths variable, it is *not* intrinsiclly thread safe // locations are unknown Warning: Because this edits the static paths
static void add_paths_to_env_variable_impl(const std::string & to_add) { // variable, it is *not* intrinsiclly thread safe
static void add_paths_to_env_variable_impl(const std::string &to_add) {
get_mutable_paths_from_env_variable().push_back(to_add); get_mutable_paths_from_env_variable().push_back(to_add);
} }
private: private:
details::handle<std::ifstream *, details::default_delete<std::ifstream *> > details::handle<std::ifstream *, details::default_delete<std::ifstream *>>
_file; _file;
static std::vector<std::string> get_paths_from_env_variable_impl() { static std::vector<std::string> get_paths_from_env_variable_impl() {
@ -3830,8 +3841,9 @@ private:
} }
static std::vector<std::string> &get_mutable_paths_from_env_variable() { static std::vector<std::string> &get_mutable_paths_from_env_variable() {
static volatile std::vector<std::string> paths = get_paths_from_env_variable_impl(); static volatile std::vector<std::string> paths =
return const_cast<std::vector<std::string>&>(paths); get_paths_from_env_variable_impl();
return const_cast<std::vector<std::string> &>(paths);
} }
static const std::vector<std::string> &get_paths_from_env_variable() { static const std::vector<std::string> &get_paths_from_env_variable() {
@ -4055,7 +4067,7 @@ private:
void print_stacktrace(ST &st, std::ostream &os, Colorize &colorize) { void print_stacktrace(ST &st, std::ostream &os, Colorize &colorize) {
print_header(os, st.thread_id()); print_header(os, st.thread_id());
_resolver.load_stacktrace(st); _resolver.load_stacktrace(st);
if ( reverse ) { if (reverse) {
for (size_t trace_idx = st.size(); trace_idx > 0; --trace_idx) { for (size_t trace_idx = st.size(); trace_idx > 0; --trace_idx) {
print_trace(os, _resolver.resolve(st[trace_idx - 1]), colorize); print_trace(os, _resolver.resolve(st[trace_idx - 1]), colorize);
} }
@ -4166,20 +4178,20 @@ class SignalHandling {
public: public:
static std::vector<int> make_default_signals() { static std::vector<int> make_default_signals() {
const int posix_signals[] = { const int posix_signals[] = {
// Signals for which the default action is "Core". // Signals for which the default action is "Core".
SIGABRT, // Abort signal from abort(3) SIGABRT, // Abort signal from abort(3)
SIGBUS, // Bus error (bad memory access) SIGBUS, // Bus error (bad memory access)
SIGFPE, // Floating point exception SIGFPE, // Floating point exception
SIGILL, // Illegal Instruction SIGILL, // Illegal Instruction
SIGIOT, // IOT trap. A synonym for SIGABRT SIGIOT, // IOT trap. A synonym for SIGABRT
SIGQUIT, // Quit from keyboard SIGQUIT, // Quit from keyboard
SIGSEGV, // Invalid memory reference SIGSEGV, // Invalid memory reference
SIGSYS, // Bad argument to routine (SVr4) SIGSYS, // Bad argument to routine (SVr4)
SIGTRAP, // Trace/breakpoint trap SIGTRAP, // Trace/breakpoint trap
SIGXCPU, // CPU time limit exceeded (4.2BSD) SIGXCPU, // CPU time limit exceeded (4.2BSD)
SIGXFSZ, // File size limit exceeded (4.2BSD) SIGXFSZ, // File size limit exceeded (4.2BSD)
#if defined(BACKWARD_SYSTEM_DARWIN) #if defined(BACKWARD_SYSTEM_DARWIN)
SIGEMT, // emulation instruction executed SIGEMT, // emulation instruction executed
#endif #endif
}; };
return std::vector<int>(posix_signals, return std::vector<int>(posix_signals,
@ -4243,11 +4255,11 @@ public:
#elif defined(__arm__) #elif defined(__arm__)
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.arm_pc); error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.arm_pc);
#elif defined(__aarch64__) #elif defined(__aarch64__)
#if defined(__APPLE__) #if defined(__APPLE__)
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext->__ss.__pc); error_addr = reinterpret_cast<void *>(uctx->uc_mcontext->__ss.__pc);
#else #else
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc); error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc);
#endif #endif
#elif defined(__mips__) #elif defined(__mips__)
error_addr = reinterpret_cast<void *>( error_addr = reinterpret_cast<void *>(
reinterpret_cast<struct sigcontext *>(&uctx->uc_mcontext)->sc_pc); reinterpret_cast<struct sigcontext *>(&uctx->uc_mcontext)->sc_pc);
@ -4276,7 +4288,7 @@ public:
printer.address = true; printer.address = true;
printer.print(st, stderr); printer.print(st, stderr);
#if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) || \ #if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) || \
(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
psiginfo(info, nullptr); psiginfo(info, nullptr);
#else #else
@ -4494,3 +4506,4 @@ public:
} // namespace backward } // namespace backward
#endif /* H_GUARD */ #endif /* H_GUARD */
#endif // defined(PROJECT_ENABLE_BACKWARD_CPP)

View File

@ -1,3 +1,4 @@
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
// Pick your poison. // Pick your poison.
// //
// On GNU/Linux, you have few choices to get the most out of your stack trace. // On GNU/Linux, you have few choices to get the most out of your stack trace.
@ -40,3 +41,4 @@ namespace backward {
backward::SignalHandling sh; backward::SignalHandling sh;
} // namespace backward } // namespace backward
#endif // defined(PROJECT_ENABLE_BACKWARD_CPP)