[Lldb-commits] [lldb] r212822 - Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.

Todd Fiala todd.fiala at gmail.com
Fri Jul 11 08:13:34 PDT 2014


Author: tfiala
Date: Fri Jul 11 10:13:33 2014
New Revision: 212822

URL: http://llvm.org/viewvc/llvm-project?rev=212822&view=rev
Log:
Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.

If we have any section headers in the collection, we already parsed them.
Therefore, don't reparse the section headers when the section_headers collection
is not empty.

See this thread for more details:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140707/011721.html

Change by Matthew Gardiner

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=212822&r1=212821&r2=212822&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Jul 11 10:13:33 2014
@@ -1242,6 +1242,10 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
                                     uint32_t &gnu_debuglink_crc,
                                     ArchSpec &arch_spec)
 {
+    // Don't reparse the section headers if we already did that.
+    if (!section_headers.empty())
+        return section_headers.size();
+
     // Only initialize the arch_spec to okay defaults if they're not already set.
     // We'll refine this with note data as we parse the notes.
     if (arch_spec.GetTriple ().getOS () == llvm::Triple::OSType::UnknownOS)
@@ -1251,10 +1255,6 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
         arch_spec.GetTriple().setVendorName(Host::GetVendorString().GetCString());
     }
 
-    // We have already parsed the section headers
-    if (!section_headers.empty())
-        return section_headers.size();
-
     // If there are no section headers we are done.
     if (header.e_shnum == 0)
         return 0;





More information about the lldb-commits mailing list