mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 07:16:13 -04:00
Only use exception tracer for non-release builds
This commit is contained in:
parent
c262ee197b
commit
9e506aaa7d
@ -460,6 +460,15 @@ if(USE_JEMALLOC)
|
||||
list(APPEND INCLUDE_DIRS ${Jemalloc_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
set(DWARFS_USE_EXCEPTION_TRACER OFF)
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
if(NOT STATIC_BUILD_DO_NOT_USE)
|
||||
if(TARGET folly_exception_tracer)
|
||||
set(DWARFS_USE_EXCEPTION_TRACER ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(
|
||||
thrift_light
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fbthrift/thrift/lib/cpp2/FieldRef.cpp
|
||||
@ -510,6 +519,10 @@ foreach(tgt dwarfs ${BINARY_TARGETS})
|
||||
$<$<BOOL:${LIBLZMA_FOUND}>:DWARFS_HAVE_LIBLZMA>
|
||||
$<$<BOOL:${WITH_PYTHON}>:DWARFS_HAVE_PYTHON>)
|
||||
|
||||
if(DWARFS_USE_EXCEPTION_TRACER)
|
||||
target_compile_definitions(${tgt} PRIVATE DWARFS_USE_EXCEPTION_TRACER)
|
||||
endif()
|
||||
|
||||
target_compile_options(${tgt} PRIVATE -Wall -Wextra -pedantic)
|
||||
|
||||
set_property(TARGET ${tgt} PROPERTY CXX_STANDARD 17)
|
||||
@ -597,7 +610,7 @@ foreach(tgt ${BINARY_TARGETS})
|
||||
if(USE_JEMALLOC)
|
||||
target_link_libraries(${tgt} ${Jemalloc_LIBRARIES})
|
||||
endif()
|
||||
if(TARGET folly_exception_tracer)
|
||||
if(DWARFS_USE_EXCEPTION_TRACER)
|
||||
target_link_libraries(
|
||||
${tgt} -Wl,--whole-archive folly_exception_tracer_base
|
||||
folly_exception_tracer -Wl,--no-whole-archive)
|
||||
|
@ -24,9 +24,12 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <folly/String.h>
|
||||
#include <folly/experimental/exception_tracer/ExceptionTracer.h>
|
||||
#include <folly/experimental/symbolizer/SignalHandler.h>
|
||||
|
||||
#ifdef DWARFS_USE_EXCEPTION_TRACER
|
||||
#include <folly/experimental/exception_tracer/ExceptionTracer.h>
|
||||
#endif
|
||||
|
||||
#include "dwarfs/error.h"
|
||||
|
||||
namespace dwarfs {
|
||||
@ -51,7 +54,7 @@ system_error::system_error(int err, char const* file, int line) noexcept
|
||||
, line_(line) {}
|
||||
|
||||
void dump_exceptions() {
|
||||
#if !DWARFS_STATIC_BUILD && FOLLY_HAVE_ELF && FOLLY_HAVE_DWARF
|
||||
#ifdef DWARFS_USE_EXCEPTION_TRACER
|
||||
auto exceptions = ::folly::exception_tracer::getCurrentExceptions();
|
||||
for (auto& exc : exceptions) {
|
||||
std::cerr << exc << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user