Clean up logic a bit
This commit is contained in:
parent
d3c7e7351c
commit
abbc77dcea
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace cpptrace {
|
namespace cpptrace {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
#if IS_LINUX || IS_APPLE
|
#if IS_LINUX
|
||||||
inline std::string resolve_l_name(const char* l_name) {
|
inline std::string resolve_l_name(const char* l_name) {
|
||||||
if(l_name != nullptr && l_name[0] != 0) {
|
if(l_name != nullptr && l_name[0] != 0) {
|
||||||
return l_name;
|
return l_name;
|
||||||
@ -38,7 +38,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CPPTRACE_HAS_DL_FIND_OBJECT
|
#ifdef CPPTRACE_HAS_DL_FIND_OBJECT // we don't even check for this on apple
|
||||||
inline object_frame get_frame_object_info(frame_ptr address) {
|
inline object_frame get_frame_object_info(frame_ptr address) {
|
||||||
// Use _dl_find_object when we can, it's orders of magnitude faster
|
// Use _dl_find_object when we can, it's orders of magnitude faster
|
||||||
object_frame frame;
|
object_frame frame;
|
||||||
@ -52,7 +52,6 @@ namespace detail {
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if IS_LINUX
|
|
||||||
// dladdr queries are needed to get pre-ASLR addresses and targets to run addr2line on
|
// dladdr queries are needed to get pre-ASLR addresses and targets to run addr2line on
|
||||||
inline object_frame get_frame_object_info(frame_ptr address) {
|
inline object_frame get_frame_object_info(frame_ptr address) {
|
||||||
// reference: https://github.com/bminor/glibc/blob/master/debug/backtracesyms.c
|
// reference: https://github.com/bminor/glibc/blob/master/debug/backtracesyms.c
|
||||||
@ -78,7 +77,8 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
|
#elif IS_APPLE
|
||||||
// macos doesn't have dladdr1 but it seems its dli_fname behaves more sensibly?
|
// macos doesn't have dladdr1 but it seems its dli_fname behaves more sensibly?
|
||||||
// dladdr queries are needed to get pre-ASLR addresses and targets to run addr2line on
|
// dladdr queries are needed to get pre-ASLR addresses and targets to run addr2line on
|
||||||
inline object_frame get_frame_object_info(frame_ptr address) {
|
inline object_frame get_frame_object_info(frame_ptr address) {
|
||||||
@ -100,8 +100,6 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
inline std::string get_module_name(HMODULE handle) {
|
inline std::string get_module_name(HMODULE handle) {
|
||||||
static std::mutex mutex;
|
static std::mutex mutex;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user