[Lldb-commits] [lldb] r217782 - Handle ARM ELF symbols properly: skip $t* and $a* symbols in ObjectFileELF.

Todd Fiala todd.fiala at gmail.com
Mon Sep 15 09:27:45 PDT 2014


Author: tfiala
Date: Mon Sep 15 11:27:44 2014
New Revision: 217782

URL: http://llvm.org/viewvc/llvm-project?rev=217782&view=rev
Log:
Handle ARM ELF symbols properly: skip $t* and $a* symbols in ObjectFileELF.

ELF objects contain marker symbols to differentiate between ARM and
THUMB functions. Instead of storing them internally and having garbage
show up when symbols are searched for by the user, we can just skip them
and not store them at all, as we never actually need them.

Change by Stephane Sezer.

Tested:
Ubuntu 14.04 x86_64
MacOSX 10.9.4 x86_64

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=217782&r1=217781&r2=217782&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Sep 15 11:27:44 2014
@@ -1746,6 +1746,32 @@ ObjectFileELF::ParseSymbols (Symtab *sym
             }
         }
 
+        ArchSpec arch;
+
+        if (GetArchitecture(arch) &&
+            arch.GetMachine() == llvm::Triple::arm)
+        {
+            // ELF symbol tables may contain some mapping symbols. They provide
+            // information about the underlying data. There are three of them
+            // currently defined:
+            //   $a[.<any>]* - marks an ARM instruction sequence
+            //   $t[.<any>]* - marks a THUMB instruction sequence
+            //   $d[.<any>]* - marks a data item sequence (e.g. lit pool)
+            // These symbols interfere with normal debugger operations and we
+            // don't need them. We can drop them here.
+
+            static const llvm::StringRef g_armelf_arm_marker("$a");
+            static const llvm::StringRef g_armelf_thumb_marker("$t");
+            static const llvm::StringRef g_armelf_data_marker("$d");
+            llvm::StringRef symbol_name_ref(symbol_name);
+
+            if (symbol_name &&
+                (symbol_name_ref.startswith(g_armelf_arm_marker) ||
+                 symbol_name_ref.startswith(g_armelf_thumb_marker) ||
+                 symbol_name_ref.startswith(g_armelf_data_marker)))
+                continue;
+        }
+
         // If the symbol section we've found has no data (SHT_NOBITS), then check the module section
         // list. This can happen if we're parsing the debug file and it has no .text section, for example.
         if (symbol_section_sp && (symbol_section_sp->GetFileSize() == 0))





More information about the lldb-commits mailing list