Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/unwind_dwfl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ void trace_unwinding_end(UnwindState *us) {
}
}

bool is_infinite_loop(UnwindState *us) {
UnwindOutput &output = us->output;
uint64_t const nb_locs = output.locs.size();
unsigned const nb_frames_to_check = 3;
if (nb_locs <= nb_frames_to_check) {
return false;
}
for (unsigned i = 1; i < nb_frames_to_check; ++i) {
FunLoc const &n_minus_one_loc = output.locs[nb_locs - i];
FunLoc const &n_minus_two_loc = output.locs[nb_locs - i - 1];
if (n_minus_one_loc.ip != n_minus_two_loc.ip) {
return false;
}
}
return true;
}

// check for runtime symbols provided in /tmp files
DDRes add_runtime_symbol_frame(UnwindState *us, const Dso &dso, ElfAddress_t pc,
std::string_view jitdump_path);
Expand Down Expand Up @@ -184,16 +167,9 @@ int frame_cb(Dwfl_Frame *dwfl_frame, void *arg) {
#ifdef DEBUG
LG_NFO("Begin depth %lu", us->output.locs.size());
#endif
int const dwfl_error_value = dwfl_errno();
if (dwfl_error_value) {
// Check if dwarf unwinding was a failure we can get stuck in infinite loops
if (is_infinite_loop(us)) {
LG_DBG("Break out of unwinding (possible infinite loop)");
return DWARF_CB_ABORT;
}
}
#ifdef DEBUG
// We often fallback to frame pointer unwinding (which logs an error)
int const dwfl_error_value = dwfl_errno();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a minor doubt on how useful it is to read the errno value.

if (dwfl_error_value) {
LG_DBG("Error flagged at depth = %lu -- %d Error:%s ",
us->output.locs.size(), dwfl_error_value,
Expand Down