Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 845292f2 authored by Christopher Ferris's avatar Christopher Ferris Committed by Automerger Merge Worker
Browse files

Merge "Update for MapInfo objects in frame data." am: c54ddc2b

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1906716

Change-Id: I5c68bbb1e907525096e04791f5c1f0b553f98c82
parents c189ae4f c54ddc2b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ void GwpAsanCrashData::AddCauseProtos(Tombstone* tombstone, unwindstack::Unwinde
  for (size_t i = 0; i != num_frames; ++i) {
    unwindstack::FrameData frame_data = unwinder->BuildFrameFromPcOnly(frames[i]);
    BacktraceFrame* f = heap_object->add_allocation_backtrace();
    fill_in_backtrace_frame(f, frame_data, unwinder->GetMaps());
    fill_in_backtrace_frame(f, frame_data);
  }

  heap_object->set_deallocation_tid(__gwp_asan_get_deallocation_thread_id(responsible_allocation_));
@@ -156,7 +156,7 @@ void GwpAsanCrashData::AddCauseProtos(Tombstone* tombstone, unwindstack::Unwinde
  for (size_t i = 0; i != num_frames; ++i) {
    unwindstack::FrameData frame_data = unwinder->BuildFrameFromPcOnly(frames[i]);
    BacktraceFrame* f = heap_object->add_deallocation_backtrace();
    fill_in_backtrace_frame(f, frame_data, unwinder->GetMaps());
    fill_in_backtrace_frame(f, frame_data);
  }

  set_human_readable_cause(cause, crash_address_);
+1 −3
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ class Tombstone;

namespace unwindstack {
struct FrameData;
class Maps;
class Unwinder;
}

@@ -68,8 +67,7 @@ bool tombstone_proto_to_text(
    const Tombstone& tombstone,
    std::function<void(const std::string& line, bool should_log)> callback);

void fill_in_backtrace_frame(BacktraceFrame* f, const unwindstack::FrameData& frame,
                             unwindstack::Maps* maps);
void fill_in_backtrace_frame(BacktraceFrame* f, const unwindstack::FrameData& frame);
void set_human_readable_cause(Cause* cause, uint64_t fault_addr);

#endif  // _DEBUGGERD_TOMBSTONE_H
+2 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ void ScudoCrashData::FillInCause(Cause* cause, const scudo_error_report* report,
  for (size_t i = 0; i < arraysize(report->allocation_trace) && report->allocation_trace[i]; ++i) {
    unwindstack::FrameData frame_data = unwinder->BuildFrameFromPcOnly(report->allocation_trace[i]);
    BacktraceFrame* f = heap_object->add_allocation_backtrace();
    fill_in_backtrace_frame(f, frame_data, unwinder->GetMaps());
    fill_in_backtrace_frame(f, frame_data);
  }

  heap_object->set_deallocation_tid(report->deallocation_tid);
@@ -117,7 +117,7 @@ void ScudoCrashData::FillInCause(Cause* cause, const scudo_error_report* report,
    unwindstack::FrameData frame_data =
        unwinder->BuildFrameFromPcOnly(report->deallocation_trace[i]);
    BacktraceFrame* f = heap_object->add_deallocation_backtrace();
    fill_in_backtrace_frame(f, frame_data, unwinder->GetMaps());
    fill_in_backtrace_frame(f, frame_data);
  }

  set_human_readable_cause(cause, untagged_fault_addr_);
+11 −13
Original line number Diff line number Diff line
@@ -312,8 +312,7 @@ static void dump_open_fds(Tombstone* tombstone, const OpenFilesList* open_files)
  }
}

void fill_in_backtrace_frame(BacktraceFrame* f, const unwindstack::FrameData& frame,
                             unwindstack::Maps* maps) {
void fill_in_backtrace_frame(BacktraceFrame* f, const unwindstack::FrameData& frame) {
  f->set_rel_pc(frame.rel_pc);
  f->set_pc(frame.pc);
  f->set_sp(frame.sp);
@@ -331,21 +330,20 @@ void fill_in_backtrace_frame(BacktraceFrame* f, const unwindstack::FrameData& fr

  f->set_function_offset(frame.function_offset);

  if (frame.map_start == frame.map_end) {
  if (frame.map_info == nullptr) {
    // No valid map associated with this frame.
    f->set_file_name("<unknown>");
  } else if (!frame.map_name.empty()) {
    f->set_file_name(frame.map_name);
  } else {
    f->set_file_name(StringPrintf("<anonymous:%" PRIx64 ">", frame.map_start));
    return;
  }

  f->set_file_map_offset(frame.map_elf_start_offset);

  auto map_info = maps->Find(frame.map_start);
  if (map_info.get() != nullptr) {
    f->set_build_id(map_info->GetPrintableBuildID());
  if (!frame.map_info->name().empty()) {
    f->set_file_name(frame.map_info->GetFullName());
  } else {
    f->set_file_name(StringPrintf("<anonymous:%" PRIx64 ">", frame.map_info->start()));
  }
  f->set_file_map_offset(frame.map_info->elf_start_offset());

  f->set_build_id(frame.map_info->GetPrintableBuildID());
}

static void dump_thread(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
@@ -434,7 +432,7 @@ static void dump_thread(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
    unwinder->SetDisplayBuildID(true);
    for (const auto& frame : unwinder->frames()) {
      BacktraceFrame* f = thread.add_current_backtrace();
      fill_in_backtrace_frame(f, frame, maps);
      fill_in_backtrace_frame(f, frame);
    }
  }