I'll have a look later this morning. That code indeed is intended to only be run before they section header parsing. It may have evolved poorly since that was my initial attempt when I thought all of files had the header ABI set correctly.<br>
<br>It is still useful as a fallback if the notes are not present.<div><br></div><div>I hadn't yet seen a calling sequence where that static method was called after parsing the section headers but clearly it sounds like you are hitting it.<span></span><br>
<br>On Thursday, July 10, 2014, Matthew Gardiner <<a href="mailto:mg11@csr.com">mg11@csr.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi folks,<br>

<br>
In my local copy of lldb source I've added a case to the if/else-if of ObjectFileELF::<u></u>RefineModuleDetailsFromNote to handle ELFs built for CSRs kalimba dsps. This parses the .note.ABI-tag I added and correctly sets up the triple as<br>

<br>
Vendor=CSR<br>
OS=Unknown<br>
<br>
This works really well for my kalimba ELFs so thanks to Todd, Ed, Greg and anyone else, for getting this code in. (When I eventually get my llvm::Triple modifications upstream, I'll try to send to lldb my kalimba changes).<br>

<br>
However, I have spotted a slight bug in ObjectFileELF::<u></u>GetSectionHeaderInfo. The problem is in this stanza:<br>
<br>
// Only initialize the arch_spec to okay defaults...<br>
// We'll refine this with note data as we parse the notes.<br>
if (arch_spec.GetTriple ().getOS () == llvm::Triple::OSType::<u></u>UnknownOS)<br>
{<br>
  arch_spec.SetArchitecture (eArchTypeELF..<br>
  arch_spec.GetTriple().<u></u>setOSName (Host::GetOSString..<br>
  arch_spec.GetTriple().<u></u>setVendorName(Host::<u></u>GetVendorString..<br>
<br>
Initialising the arch_spec this way is fine, when the section headers have not been parsed. However, if the section headers have been parsed, then this is problematic since the arch_spec is modified and then function is exit due to the following statement:<br>

<br>
// We have already parsed the section headers<br>
if (!section_headers.empty())<br>
  return section_headers.size();<br>
<br>
I think if we return from GetSectionHeaderInfo immediately when the section_headers are not empty we solve this problem. I've attached a patch which does this.<br>
<br>
What do people think?<br>
<br>
thanks<br>
Matthew Gardiner<br>
<br>
<br>
Index: source/Plugins/ObjectFile/ELF/<u></u>ObjectFileELF.cpp<br>
==============================<u></u>==============================<u></u>=======<br>
--- source/Plugins/ObjectFile/ELF/<u></u>ObjectFileELF.cpp     (revision 212686)<br>
+++ source/Plugins/ObjectFile/ELF/<u></u>ObjectFileELF.cpp     (working copy)<br>
@@ -1242,6 +1242,10 @@<br>
                                     uint32_t &gnu_debuglink_crc,<br>
                                     ArchSpec &arch_spec)<br>
 {<br>
+    // We have already parsed the section headers<br>
+    if (!section_headers.empty())<br>
+        return section_headers.size();<br>
+<br>
     // Only initialize the arch_spec to okay defaults if they're not already set.<br>
     // We'll refine this with note data as we parse the notes.<br>
     if (arch_spec.GetTriple ().getOS () == llvm::Triple::OSType::<u></u>UnknownOS)<br>
@@ -1251,10 +1255,6 @@<br>
<br>
arch_spec.GetTriple().<u></u>setVendorName(Host::<u></u>GetVendorString().GetCString()<u></u>);<br>
     }<br>
<br>
-    // We have already parsed the section headers<br>
-    if (!section_headers.empty())<br>
-        return section_headers.size();<br>
-<br>
     // If there are no section headers we are done.<br>
     if (header.e_shnum == 0)<br>
         return 0;<br>
<br>
<br>
<br>
<br>
<br>
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<br>

More information can be found at <a href="http://www.csr.com" target="_blank">www.csr.com</a>. Keep up to date with CSR on our technical blog, <a href="http://www.csr.com/blog" target="_blank">www.csr.com/blog</a>, CSR people blog, <a href="http://www.csr.com/people" target="_blank">www.csr.com/people</a>, YouTube, <a href="http://www.youtube.com/user/CSRplc" target="_blank">www.youtube.com/user/CSRplc</a>, Facebook, <a href="http://www.facebook.com/pages/CSR/191038434253534" target="_blank">www.facebook.com/pages/CSR/<u></u>191038434253534</a>, or follow us on Twitter at <a href="http://www.twitter.com/CSR_plc" target="_blank">www.twitter.com/CSR_plc</a>.<br>

New for 2014, you can now access the wide range of products powered by aptX at <a href="http://www.aptx.com" target="_blank">www.aptx.com</a>.<br>
</blockquote></div><br><br>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div><br>