Fix thumb bit in the oatdump symbolizer.
MethodDebugInfo expects code address without the bit set.
Therefore we need to clear it before passing it to the DWARF writer.
Change-Id: I37586b19f2a3fc95107abb6204a34e95a3816936
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 48a9d91..25691f1 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -248,6 +248,10 @@
return;
}
+ uint32_t entry_point = oat_method.GetCodeOffset() - oat_header.GetExecutableOffset();
+ // Clear Thumb2 bit.
+ const void* code_address = EntryPointToCodePointer(reinterpret_cast<void*>(entry_point));
+
debug::MethodDebugInfo info = debug::MethodDebugInfo();
info.trampoline_name = nullptr;
info.dex_file = &dex_file;
@@ -260,7 +264,7 @@
info.is_native_debuggable = oat_header.IsNativeDebuggable();
info.is_optimized = method_header->IsOptimized();
info.is_code_address_text_relative = true;
- info.code_address = oat_method.GetCodeOffset() - oat_header.GetExecutableOffset();
+ info.code_address = reinterpret_cast<uintptr_t>(code_address);
info.code_size = method_header->GetCodeSize();
info.frame_size_in_bytes = method_header->GetFrameSizeInBytes();
info.code_info = info.is_optimized ? method_header->GetOptimizedCodeInfoPtr() : nullptr;