summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Gao2018-04-20 14:04:41 -0500
committerJosh Gao2018-04-20 15:23:20 -0500
commit5d1c14f41bac357c730aa47d705c1f1da7625280 (patch)
tree7e33631043e5fa3fb04a5bac82685b0e753eb56b /debuggerd
parent2f37a15472945194fed528cb8d3104aa4865fc4c (diff)
downloadplatform-system-core-5d1c14f41bac357c730aa47d705c1f1da7625280.tar.gz
platform-system-core-5d1c14f41bac357c730aa47d705c1f1da7625280.tar.xz
platform-system-core-5d1c14f41bac357c730aa47d705c1f1da7625280.zip
libdebuggerd: clone registers before we Unwind with them.
Bug: http://b/77296294 Test: manual inspection of tombstone generated by crasher Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/libdebuggerd/tombstone.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index 55d6204ac..2b7529217 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -422,8 +422,10 @@ static bool dump_thread(log_t* log, BacktraceMap* map, Memory* process_memory,
422 422
423 dump_registers(log, thread_info.registers.get()); 423 dump_registers(log, thread_info.registers.get());
424 424
425 // Unwind will mutate the registers, so make a copy first.
426 std::unique_ptr<Regs> regs_copy(thread_info.registers->Clone());
425 std::vector<backtrace_frame_data_t> frames; 427 std::vector<backtrace_frame_data_t> frames;
426 if (!Backtrace::Unwind(thread_info.registers.get(), map, &frames, 0, nullptr)) { 428 if (!Backtrace::Unwind(regs_copy.get(), map, &frames, 0, nullptr)) {
427 _LOG(log, logtype::THREAD, "Failed to unwind"); 429 _LOG(log, logtype::THREAD, "Failed to unwind");
428 return false; 430 return false;
429 } 431 }