[Lldb-commits] [PATCH] ObjectFileELF::GetSectionHeaderInfo sets arch_spec unnecessarily

Matthew Gardiner mg11 at csr.com
Fri Jul 11 00:08:38 PDT 2014

Todd Fiala wrote:
> Matthew,
> Your patch looks good to me. I would like Greg and/or Ed to have a 
> look at it too. If they don’t object, I can submit it.
> I ran tests on Linux and MacOSX with the patch applied (with a slight 
> indentation fix to the patch to fix some kind of strange spacing in my 
> Chrome browser with this line:
> |arch_spec.GetTriple().setVendorName(Host::GetVendorString().GetCString());
> |
> The tests came back clean.

Cool, however a better patch may be to prevent 
ObjectFileELF::GetArchitecture from calling ParseSectionHeaders again. I 
do allude to this in my last email on this thread. I've attached a patch 
for doing this. Hopefully we can submit either this or my earlier one. 
(But I think this one is best :-).


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp    (revision 212686)
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp    (working copy)
@@ -2569,8 +2569,11 @@
      if (!ParseHeader())
          return false;

-    // Allow elf notes to be parsed which may affect the detected 
-    ParseSectionHeaders();
+    if (m_section_headers.empty())
+    {
+        // Allow elf notes to be parsed which may affect the detected 
+        ParseSectionHeaders();
+    }

      arch = m_arch_spec;
      return true;

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ObjectFileELF.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140711/56ab2a9d/attachment.bin>

More information about the lldb-commits mailing list