[Lldb-commits] [PATCH] D14536: Add empty symbols to symtab for skipped symbols

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 10 03:33:56 PST 2015


tberghammer created this revision.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.
Herald added a subscriber: aemerson.

Add empty symbols to symtab for skipped symbols

LLDB skips several special purpose symbols during symtab parsing (e.g.:
arm/aarch64 mapping symbols) because we don't use them in later stages.
This CL changes the behavior to add an empty symbol to the symtab for
each skipped symbol to preserve the symbol indexes between the symtab in
the object file and LLDBs representation (it is needed because the
relocations are referencing the symbols by index).

http://reviews.llvm.org/D14536

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2019,12 +2019,18 @@
         // No need to add non-section symbols that have no names
         if (symbol.getType() != STT_SECTION &&
             (symbol_name == NULL || symbol_name[0] == '\0'))
+        {
+            symtab->AddSymbol(Symbol());
             continue;
+        }
 
         // Skipping oatdata and oatexec sections if it is requested. See details above the
         // definition of skip_oatdata_oatexec for the reasons.
         if (skip_oatdata_oatexec && (::strcmp(symbol_name, "oatdata") == 0 || ::strcmp(symbol_name, "oatexec") == 0))
+        {
+            symtab->AddSymbol(Symbol());
             continue;
+        }
 
         SectionSP symbol_section_sp;
         SymbolType symbol_type = eSymbolTypeInvalid;
@@ -2141,7 +2147,10 @@
                         }
                     }
                     if (mapping_symbol)
+                    {
+                        symtab->AddSymbol(Symbol());
                         continue;
+                    }
                 }
             }
             else if (arch.GetMachine() == llvm::Triple::aarch64)
@@ -2164,7 +2173,10 @@
                         }
                     }
                     if (mapping_symbol)
+                    {
+                        symtab->AddSymbol(Symbol());
                         continue;
+                    }
                 }
             }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14536.39800.patch
Type: text/x-patch
Size: 1606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151110/f6c044cd/attachment.bin>


More information about the lldb-commits mailing list