[Lldb-commits] [lldb] r174984 - Fix ELF parsing where undefined symbols were being added to the symbol table with the incorrect symbol type.

Matt Kopec Matt.Kopec at intel.com
Tue Feb 12 10:30:30 PST 2013


Author: mkopec
Date: Tue Feb 12 12:30:30 2013
New Revision: 174984

URL: http://llvm.org/viewvc/llvm-project?rev=174984&view=rev
Log:
Fix ELF parsing where undefined symbols were being added to the symbol table with the incorrect symbol type.

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=174984&r1=174983&r2=174984&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue Feb 12 12:30:30 2013
@@ -750,37 +750,41 @@ ParseSymbols(Symtab *symtab,
             break;
         }
 
-        switch (symbol.getType())
+        // If a symbol is undefined do not process it further even if it has a STT type
+        if (symbol_type != eSymbolTypeUndefined)
         {
-        default:
-        case STT_NOTYPE:
-            // The symbol's type is not specified.
-            break;
-
-        case STT_OBJECT:
-            // The symbol is associated with a data object, such as a variable,
-            // an array, etc.
-            symbol_type = eSymbolTypeData;
-            break;
-
-        case STT_FUNC:
-            // The symbol is associated with a function or other executable code.
-            symbol_type = eSymbolTypeCode;
-            break;
-
-        case STT_SECTION:
-            // The symbol is associated with a section. Symbol table entries of
-            // this type exist primarily for relocation and normally have
-            // STB_LOCAL binding.
-            break;
-
-        case STT_FILE:
-            // Conventionally, the symbol's name gives the name of the source
-            // file associated with the object file. A file symbol has STB_LOCAL
-            // binding, its section index is SHN_ABS, and it precedes the other
-            // STB_LOCAL symbols for the file, if it is present.
-            symbol_type = eSymbolTypeObjectFile;
-            break;
+            switch (symbol.getType())
+            {
+            default:
+            case STT_NOTYPE:
+                // The symbol's type is not specified.
+                break;
+
+            case STT_OBJECT:
+                // The symbol is associated with a data object, such as a variable,
+                // an array, etc.
+                symbol_type = eSymbolTypeData;
+                break;
+
+            case STT_FUNC:
+                // The symbol is associated with a function or other executable code.
+                symbol_type = eSymbolTypeCode;
+                break;
+
+            case STT_SECTION:
+                // The symbol is associated with a section. Symbol table entries of
+                // this type exist primarily for relocation and normally have
+                // STB_LOCAL binding.
+                break;
+
+            case STT_FILE:
+                // Conventionally, the symbol's name gives the name of the source
+                // file associated with the object file. A file symbol has STB_LOCAL
+                // binding, its section index is SHN_ABS, and it precedes the other
+                // STB_LOCAL symbols for the file, if it is present.
+                symbol_type = eSymbolTypeObjectFile;
+                break;
+            }
         }
 
         if (symbol_type == eSymbolTypeInvalid)





More information about the lldb-commits mailing list