diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/common/stack_trace.cpp | 4 | ||||
-rw-r--r-- | src/daemon/main.cpp | 7 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 9afbe4b82..7a2457c93 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -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) diff --git a/src/common/stack_trace.cpp b/src/common/stack_trace.cpp index 44002e2d5..4387d4ffd 100644 --- a/src/common/stack_trace.cpp +++ b/src/common/stack_trace.cpp @@ -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 diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 638fae20e..2e8953af9 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -31,7 +31,6 @@ #include "common/command_line.h" #include "common/scoped_message_writer.h" #include "common/util.h" -#include "common/stack_trace.h" #include "cryptonote_core/cryptonote_core.h" #include "cryptonote_core/miner.h" #include "daemon/command_server.h" @@ -44,6 +43,10 @@ #include "daemon/command_line_args.h" #include "blockchain_db/db_types.h" +#ifdef STACK_TRACE +#include "common/stack_trace.h" +#endif // STACK_TRACE + namespace po = boost::program_options; namespace bf = boost::filesystem; @@ -269,7 +272,9 @@ int main(int argc, char const * argv[]) , log_file_path.filename().string().c_str() , log_file_path.parent_path().string().c_str() ); +#ifdef STACK_TRACE tools::set_stack_trace_log(log_file_path.filename().string()); +#endif // STACK_TRACE } if (command_line::has_arg(vm, daemon_args::arg_max_concurrency)) |