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

Commit 5d1c14f4 authored by Josh Gao's avatar Josh Gao
Browse files

libdebuggerd: clone registers before we Unwind with them.

Bug: http://b/77296294
Test: manual inspection of tombstone generated by crasher
Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
parent 2f37a154
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -422,8 +422,10 @@ static bool dump_thread(log_t* log, BacktraceMap* map, Memory* process_memory,

  dump_registers(log, thread_info.registers.get());

  // Unwind will mutate the registers, so make a copy first.
  std::unique_ptr<Regs> regs_copy(thread_info.registers->Clone());
  std::vector<backtrace_frame_data_t> frames;
  if (!Backtrace::Unwind(thread_info.registers.get(), map, &frames, 0, nullptr)) {
  if (!Backtrace::Unwind(regs_copy.get(), map, &frames, 0, nullptr)) {
    _LOG(log, logtype::THREAD, "Failed to unwind");
    return false;
  }