OSDN Git Service

Fix thumb bit in the oatdump symbolizer.
authorDavid Srbecky <dsrbecky@google.com>
Thu, 31 Mar 2016 17:17:59 +0000 (18:17 +0100)
committerDavid Srbecky <dsrbecky@google.com>
Thu, 31 Mar 2016 18:11:43 +0000 (19:11 +0100)
MethodDebugInfo expects code address without the bit set.
Therefore we need to clear it before passing it to the DWARF writer.

Change-Id: I37586b19f2a3fc95107abb6204a34e95a3816936

oatdump/oatdump.cc

index 48a9d91..25691f1 100644 (file)
@@ -248,6 +248,10 @@ class OatSymbolizer FINAL {
       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 @@ class OatSymbolizer FINAL {
     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;