Skip to content

Commit

Permalink
fix glog inner api
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
  • Loading branch information
stdpain committed Jul 15, 2024
1 parent 62b6b19 commit 438c76f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions be/src/util/stack_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <fmt/format.h>
#include <sys/syscall.h>

#include <exception>

#include "common/config.h"
#include "gutil/strings/join.h"
#include "gutil/strings/split.h"
Expand All @@ -36,10 +34,11 @@ void DumpStackTraceToString(std::string* stacktrace);
} // namespace google::glog_internal_namespace_

// import hidden stack trace functions from glog
namespace google {
namespace google::glog_internal_namespace_ {
enum class SymbolizeOptions { kNone = 0, kNoLineNumbers = 1 };
int GetStackTrace(void** result, int max_depth, int skip_count);
bool Symbolize(void* pc, char* out, int out_size);
} // namespace google
bool Symbolize(void* pc, char* out, int out_size, SymbolizeOptions options = SymbolizeOptions::kNone);
} // namespace google::glog_internal_namespace_

namespace starrocks {

Expand All @@ -59,7 +58,7 @@ struct StackTraceTask {
for (int i = 0; i < depth; ++i) {
char line[2048];
char buf[1024];
if (google::Symbolize(addrs[i], buf, sizeof(buf))) {
if (google::glog_internal_namespace_::Symbolize(addrs[i], buf, sizeof(buf))) {
snprintf(line, 2048, " %16p %s\n", addrs[i], buf);
} else {
snprintf(line, 2048, " %16p (unknown)\n", addrs[i]);
Expand Down Expand Up @@ -93,7 +92,7 @@ struct StackTraceTaskHash {

void get_stack_trace_sighandler(int signum, siginfo_t* siginfo, void* ucontext) {
auto task = reinterpret_cast<StackTraceTask*>(siginfo->si_value.sival_ptr);
task->depth = google::GetStackTrace(task->addrs, StackTraceTask::kMaxStackDepth, 2);
task->depth = google::glog_internal_namespace_::GetStackTrace(task->addrs, StackTraceTask::kMaxStackDepth, 2);
task->done = true;
}

Expand Down

0 comments on commit 438c76f

Please sign in to comment.