[Lldb-commits] [lldb] r235171 - Fix mapping symbol handling on arm 32/64

Tamas Berghammer tberghammer at google.com
Fri Apr 17 02:37:00 PDT 2015


Author: tberghammer
Date: Fri Apr 17 04:36:59 2015
New Revision: 235171

URL: http://llvm.org/viewvc/llvm-project?rev=235171&view=rev
Log:
Fix mapping symbol handling on arm 32/64

The debug info section contains some $d mapping symbol what is
overlapping with code sections in other sections of the object file
causing problem in the address class detection. This CL ignores these
symboles from the address class map as the debug info sections don't use
this map.

Differential revision: http://reviews.llvm.org/D9050

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=235171&r1=235170&r2=235171&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Apr 17 04:36:59 2015
@@ -1878,23 +1878,26 @@ ObjectFileELF::ParseSymbols (Symtab *sym
                     // These are reserved for the specification (e.g.: mapping
                     // symbols). We don't want to add them to the symbol table.
 
-                    llvm::StringRef symbol_name_ref(symbol_name);
-                    if (symbol_name_ref == "$a" || symbol_name_ref.startswith("$a."))
+                    if (symbol_type == eSymbolTypeCode)
                     {
-                        // $a[.<any>]* - marks an ARM instruction sequence
-                        m_address_class_map[symbol.st_value] = eAddressClassCode;
-                    }
-                    else if (symbol_name_ref == "$b" || symbol_name_ref.startswith("$b.") ||
-                             symbol_name_ref == "$t" || symbol_name_ref.startswith("$t."))
-                    {
-                        // $b[.<any>]* - marks a THUMB BL instruction sequence
-                        // $t[.<any>]* - marks a THUMB instruction sequence
-                        m_address_class_map[symbol.st_value] = eAddressClassCodeAlternateISA;
-                    }
-                    else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
-                    {
-                        // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
-                        m_address_class_map[symbol.st_value] = eAddressClassData;
+                        llvm::StringRef symbol_name_ref(symbol_name);
+                        if (symbol_name_ref == "$a" || symbol_name_ref.startswith("$a."))
+                        {
+                            // $a[.<any>]* - marks an ARM instruction sequence
+                            m_address_class_map[symbol.st_value] = eAddressClassCode;
+                        }
+                        else if (symbol_name_ref == "$b" || symbol_name_ref.startswith("$b.") ||
+                                 symbol_name_ref == "$t" || symbol_name_ref.startswith("$t."))
+                        {
+                            // $b[.<any>]* - marks a THUMB BL instruction sequence
+                            // $t[.<any>]* - marks a THUMB instruction sequence
+                            m_address_class_map[symbol.st_value] = eAddressClassCodeAlternateISA;
+                        }
+                        else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
+                        {
+                            // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
+                            m_address_class_map[symbol.st_value] = eAddressClassData;
+                        }
                     }
 
                     continue;
@@ -1907,16 +1910,19 @@ ObjectFileELF::ParseSymbols (Symtab *sym
                     // These are reserved for the specification (e.g.: mapping
                     // symbols). We don't want to add them to the symbol table.
 
-                    llvm::StringRef symbol_name_ref(symbol_name);
-                    if (symbol_name_ref == "$x" || symbol_name_ref.startswith("$x."))
-                    {
-                        // $x[.<any>]* - marks an A64 instruction sequence
-                        m_address_class_map[symbol.st_value] = eAddressClassCode;
-                    }
-                    else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
+                    if (symbol_type == eSymbolTypeCode)
                     {
-                        // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
-                        m_address_class_map[symbol.st_value] = eAddressClassData;
+                        llvm::StringRef symbol_name_ref(symbol_name);
+                        if (symbol_name_ref == "$x" || symbol_name_ref.startswith("$x."))
+                        {
+                            // $x[.<any>]* - marks an A64 instruction sequence
+                            m_address_class_map[symbol.st_value] = eAddressClassCode;
+                        }
+                        else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
+                        {
+                            // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
+                            m_address_class_map[symbol.st_value] = eAddressClassData;
+                        }
                     }
 
                     continue;





More information about the lldb-commits mailing list