[Lldb-commits] [PATCH] D14507: Make sure we use symbol flags to detect thumbness.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 13:05:31 PST 2015


clayborg added a comment.

See Inlined comment.


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:975-997
@@ -974,5 +974,25 @@
     {
-        // No entry in the address class map before the address. Return
-        // default address class for an address in a code section.
-        return eAddressClassCode;
+        // No entry in the address class map before the address. Try finding
+        // the address class by using symbol flags, otherwise return default
+        // address class for an address in a code section.
+
+        ArchSpec arch_spec;
+        GetArchitecture(arch_spec);
+        if (arch_spec.GetMachine() != llvm::Triple::arm)
+            return res;
+
+        auto symtab = GetSymtab();
+        if (symtab == nullptr)
+            return res;
+
+        auto symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+        if (symbol == nullptr)
+            return res;
+
+        // Thumb symbols have the lower bit set in the flags field so we just check
+        // for that.
+        if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
+            res = eAddressClassCodeAlternateISA;
+
+        return res;
     }
----------------
Remove this and move it to ObjectFileELF::ParseSymbols()


http://reviews.llvm.org/D14507





More information about the lldb-commits mailing list