This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 098f2fe708 [fix][branch-2.0](stacktrace) Fix compile option USE_UNWIND
(#22683)
098f2fe708 is described below
commit 098f2fe70834c5a103b74a535d5a299fb34a7224
Author: Xinyi Zou <[email protected]>
AuthorDate: Wed Aug 9 22:34:28 2023 +0800
[fix][branch-2.0](stacktrace) Fix compile option USE_UNWIND (#22683)
---
be/src/common/stack_trace.cpp | 8 ++++++--
be/src/util/stack_util.cpp | 4 ----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/be/src/common/stack_trace.cpp b/be/src/common/stack_trace.cpp
index 9e951b6532..14d72526e0 100644
--- a/be/src/common/stack_trace.cpp
+++ b/be/src/common/stack_trace.cpp
@@ -39,6 +39,8 @@
#if USE_UNWIND
#include <libunwind.h>
+#else
+#include <execinfo.h>
#endif
namespace {
@@ -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
diff --git a/be/src/util/stack_util.cpp b/be/src/util/stack_util.cpp
index dd143ead3f..70606b26e4 100644
--- a/be/src/util/stack_util.cpp
+++ b/be/src/util/stack_util.cpp
@@ -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";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]