Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Oct 7, 2023
1 parent 09c10b8 commit 9454e83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
26 changes: 12 additions & 14 deletions be/src/common/stack_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,13 @@ static void toStringEveryLineImpl([[maybe_unused]] const std::string dwarf_locat
out << " ?";
}

if (shouldShowAddress(physical_addr)) {
out << " @ ";
writePointerHex(physical_addr, out);
}
// Do not display the stack address and file name, it is not important.
// if (shouldShowAddress(physical_addr)) {
// out << " @ ";
// writePointerHex(physical_addr, out);
// }

out << " in " << (object ? object->name : "?");
// out << " in " << (object ? object->name : "?");

callback(out.str());

Expand Down Expand Up @@ -459,15 +460,12 @@ std::string toStringCached(const StackTrace::FramePointers& pointers, size_t off
}

std::string StackTrace::toString(int start_pointers_index) const {
if (start_pointers_index == 0) {
return toStringCached(frame_pointers, offset, size);
} else {
// Start output from the start_pointers_index position of frame pointers.
StackTrace::FramePointers frame_pointers_raw {};
std::copy(frame_pointers.begin() + start_pointers_index, frame_pointers.end(),
frame_pointers_raw.begin());
return toStringCached(frame_pointers_raw, offset, size - start_pointers_index);
}
// Default delete the first three frame pointers, which are inside the stack_trace.cpp.
start_pointers_index += 3;
StackTrace::FramePointers frame_pointers_raw {};
std::copy(frame_pointers.begin() + start_pointers_index, frame_pointers.end(),
frame_pointers_raw.begin());
return toStringCached(frame_pointers_raw, offset, size - start_pointers_index);
}

std::string StackTrace::toString(void** frame_pointers_raw, size_t offset, size_t size) {
Expand Down
4 changes: 2 additions & 2 deletions be/src/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ class [[nodiscard]] Status {
}
#ifdef ENABLE_STACKTRACE
if constexpr (stacktrace && capture_stacktrace(code)) {
// Delete the first four frame pointers, which are inside the StackTrace and Status.
status._err_msg->_stack = get_stack_trace(4);
// Delete the first one frame pointers, which are inside the status.h
status._err_msg->_stack = get_stack_trace(1);
LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
}
#endif
Expand Down

0 comments on commit 9454e83

Please sign in to comment.