Skip to content

Commit

Permalink
[fix][branch-2.0](stacktrace) Fix compile option USE_UNWIND (#22683)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz authored Aug 9, 2023
1 parent b7d6e8a commit 098f2fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions be/src/common/stack_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#if USE_UNWIND
#include <libunwind.h>
#else
#include <execinfo.h>
#endif

namespace {
Expand Down Expand Up @@ -294,12 +296,14 @@ StackTrace::StackTrace(const ucontext_t& signal_context) {
}

void StackTrace::tryCapture() {
// When unw_backtrace is not available, fall back on the standard
// `backtrace` function from execinfo.h.
#if USE_UNWIND
size = unw_backtrace(frame_pointers.data(), capacity);
__msan_unpoison(frame_pointers.data(), size * sizeof(frame_pointers[0]));
#else
size = 0;
size = backtrace(frame_pointers.data(), capacity);
#endif
__msan_unpoison(frame_pointers.data(), size * sizeof(frame_pointers[0]));
}

/// ClickHouse uses bundled libc++ so type names will be the same on every system thus it's safe to hardcode them
Expand Down
4 changes: 0 additions & 4 deletions be/src/util/stack_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ std::string get_stack_trace() {
} else if (tool == "glibc") {
return get_stack_trace_by_glibc();
} else if (tool == "libunwind") {
#if USE_UNWIND
return get_stack_trace_by_libunwind();
#else
return get_stack_trace_by_glog();
#endif
} else {
return "no stack";
}
Expand Down

0 comments on commit 098f2fe

Please sign in to comment.