From eea5fd3561ec3cc1f97b754607e69c2f84d17a6d Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Wed, 13 Feb 2019 17:24:17 +0000 Subject: Fix DumpNativeStack function for traced methods. The art_quick_instrumentation_exit stub does not have oat header. Bug: 123510633 Test: test.py -b -r --host --trace -r -t 163 Change-Id: I56d72816daf836440feccb42c81031f120e8c4c5 --- runtime/native_stack_dump.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/native_stack_dump.cc') diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc index a4425ce81a..40bab0f126 100644 --- a/runtime/native_stack_dump.cc +++ b/runtime/native_stack_dump.cc @@ -44,6 +44,7 @@ #include "arch/instruction_set.h" #include "base/aborting.h" +#include "base/bit_utils.h" #include "base/file_utils.h" #include "base/memory_tool.h" #include "base/mutex.h" @@ -51,6 +52,7 @@ #include "base/unix_file/fd_file.h" #include "base/utils.h" #include "class_linker.h" +#include "entrypoints/runtime_asm_entrypoints.h" #include "oat_quick_method_header.h" #include "runtime.h" #include "thread-current-inl.h" @@ -299,6 +301,12 @@ static bool PcIsWithinQuickCode(ArtMethod* method, uintptr_t pc) NO_THREAD_SAFET class_linker->IsQuickToInterpreterBridge(entry_point)) { return false; } + // The backtrace library might have heuristically subracted 1 from the pc, + // to pretend the pc is at the calling instruction. + DCHECK_ALIGNED(GetQuickInstrumentationExitPc(), sizeof(void*)); + if (AlignUp(reinterpret_cast(pc), sizeof(void*)) == GetQuickInstrumentationExitPc()) { + return false; + } uintptr_t code = reinterpret_cast(EntryPointToCodePointer(entry_point)); uintptr_t code_size = reinterpret_cast(code)[-1].GetCodeSize(); return code <= pc && pc <= (code + code_size); -- cgit v1.2.3-59-g8ed1b