mirror of
https://github.com/monero-project/monero.git
synced 2025-06-24 07:34:09 -04:00
cmake,common: flag for stack trace
By default the flag is enabled whenever libunwind is found on the system, with the exception of static build on OSX (for which we can't install the throw hook #932 due to lack of support for --wrap in OSX ld64 linker).
This commit is contained in:
parent
b34506da81
commit
0f990d0183
4 changed files with 35 additions and 25 deletions
|
@ -31,8 +31,11 @@ set(common_sources
|
|||
command_line.cpp
|
||||
dns_utils.cpp
|
||||
util.cpp
|
||||
i18n.cpp
|
||||
stack_trace.cpp)
|
||||
i18n.cpp)
|
||||
|
||||
if (STACK_TRACE)
|
||||
list(APPEND common_sources stack_trace.cpp)
|
||||
endif()
|
||||
|
||||
set(common_headers)
|
||||
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
|
||||
#include "common/stack_trace.h"
|
||||
#include "misc_log_ex.h"
|
||||
#ifdef HAVE_LIBUNWIND
|
||||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#endif
|
||||
#include <cxxabi.h>
|
||||
#ifndef STATICLIB
|
||||
#include <dlfcn.h>
|
||||
|
@ -96,7 +94,6 @@ void set_stack_trace_log(const std::string &log)
|
|||
|
||||
void log_stack_trace(const char *msg)
|
||||
{
|
||||
#ifdef HAVE_LIBUNWIND
|
||||
unw_context_t ctx;
|
||||
unw_cursor_t cur;
|
||||
unw_word_t ip, off;
|
||||
|
@ -136,7 +133,6 @@ void log_stack_trace(const char *msg)
|
|||
LOG_PRINT2(log, " " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip << " " << (!status && dsym ? dsym : sym) << " + " << "0x" << off, LOG_LEVEL_0);
|
||||
free(dsym);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace tools
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue