Check for _dl_find_object support
This commit is contained in:
parent
ac7db48cef
commit
24e64ab385
@ -78,6 +78,10 @@ if(NOT WIN32 OR MINGW)
|
|||||||
check_support(HAS_CXX_EXCEPTION_TYPE has_cxx_exception_type.cpp "" "" "")
|
check_support(HAS_CXX_EXCEPTION_TYPE has_cxx_exception_type.cpp "" "" "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
check_support(HAS_DL_FIND_OBJECT has_dl_find_object.cpp "" "" "")
|
||||||
|
endif()
|
||||||
|
|
||||||
# =============================================== Autoconfig unwinding ===============================================
|
# =============================================== Autoconfig unwinding ===============================================
|
||||||
# Unwind back-ends
|
# Unwind back-ends
|
||||||
if(
|
if(
|
||||||
@ -276,6 +280,10 @@ if(HAS_CXX_EXCEPTION_TYPE)
|
|||||||
target_compile_definitions(${target_name} PUBLIC CPPTRACE_HAS_CXX_EXCEPTION_TYPE)
|
target_compile_definitions(${target_name} PUBLIC CPPTRACE_HAS_CXX_EXCEPTION_TYPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAS_DL_FIND_OBJECT)
|
||||||
|
target_compile_definitions(${target_name} PUBLIC CPPTRACE_HAS_DL_FIND_OBJECT)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Symbols
|
# Symbols
|
||||||
if(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE)
|
if(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE)
|
||||||
if(NOT HAS_BACKTRACE)
|
if(NOT HAS_BACKTRACE)
|
||||||
|
|||||||
6
cmake/has_dl_find_object.cpp
Normal file
6
cmake/has_dl_find_object.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
dl_find_object result;
|
||||||
|
_dl_find_object(reinterpret_cast<void*>(main), &result);
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#if CPPTRACE_HAS_DL_FIND_OBJECT
|
||||||
#if IS_LINUX || IS_APPLE
|
#if IS_LINUX || IS_APPLE
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@ -55,5 +56,16 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
namespace cpptrace {
|
||||||
|
namespace detail {
|
||||||
|
inline void get_minimal_object_frame(frame_ptr address, minimal_object_frame* out) {
|
||||||
|
out->raw_address = 0;
|
||||||
|
out->address_relative_to_object_base_in_memory = 0;
|
||||||
|
out->object_path[0] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user