libdebuggerd: clone registers before we Unwind with them.

Bug: http://b/77296294
Test: manual inspection of tombstone generated by crasher
Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
(cherry picked from commit 5d1c14f41b)
This commit is contained in:
Josh Gao 2018-04-20 12:04:41 -07:00
parent fe3963143f
commit 86ea074184

View file

@ -418,8 +418,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;
}