<div dir="ltr"><div>> <span style="font-size:13px;font-family:arial,sans-serif">Please note that I copied a lot of the PlatformLinux code into PlatformKalimba<br></span><br></div><div>Oh shucks, I have a boatload of changes going into PlatformLinux to support remote debugging!  I've been stuck the last week dealing with testing, Windows-related builds/issues, and other minutiae but I am looking to getting back to this.  You can keep your eyes on the changes I check in for PlatofrmLinux to support llgs.  I'll be refactoring a bunch of code in PlatformDarwin into PlatformPOSIX, and changing a few more details in PlatformLinux.</div>
<div><br></div><div>> <span style="font-size:13px;font-family:arial,sans-serif">When I invoke "target create kalimba.elf" I actually see ObjectFileELF::</span><u style="font-size:13px;font-family:arial,sans-serif"></u><span style="font-size:13px;font-family:arial,sans-serif">GetSectionHeade</span><span style="font-size:13px;font-family:arial,sans-serif">rInfo called *several times* whilst the target is created:</span></div>
<div><br></div><div>Yeah I have a note to go back to figure out why that's the case.  When I added the note support, I saw it getting called several times when it seems like it should have been once.  The ObjectFileELF was getting created and destroyed multiple times, which I think was unintended.  I'll look closer into why that's happening.  Thanks for reminding me.</div>
<div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">It would be great if we could prevent the arch_spec being modified again, after the headers are parsed. Either with my patch or something similar. Anyway, I'm off now, so I'll catch up sometime tomorrow.</span></div>
<br style="font-family:arial,sans-serif;font-size:13px"><div>Okay, hopefully by then it will all be better :-)</div><div><br></div><div>Thanks,</div><div>Todd</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Jul 10, 2014 at 7:07 AM, Matthew Gardiner <span dir="ltr"><<a href="mailto:mg11@csr.com" target="_blank">mg11@csr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">Todd Fiala wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
<br>
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.<br>
</blockquote>
<br></div>
Hi Todd,<br>
<br>
Yup, It would be cool if you could take a look.<br>
<br>
When I invoke "target create kalimba.elf" I actually see ObjectFileELF::<u></u>GetSectionHeaderInfo called *several times* whilst the target is created:<br>
<br>
The first time...<br>
<br>
#0 ObjectFileELF::<u></u>GetSectionHeaderInfo (section_headers=std::vector of length 0, capacity 0, object_data=...,<br>
#1 ObjectFileELF::<u></u>GetModuleSpecifications<br>
#2  lldb_private::ObjectFile::<u></u>GetModuleSpecifications (overloaded function)<br>
#3  lldb_private::ObjectFile::<u></u>GetModuleSpecifications<br>
#4  lldb_private::TargetList::<u></u>CreateTarget<br>
<br>
It is subsequently called again like this:<br>
<br>
#0  ObjectFileELF::<u></u>GetSectionHeaderInfo (section_headers=std::vector of length 18,<br>
#1  ObjectFileELF::<u></u>ParseSectionHeaders (<br>
#2  ObjectFileELF::GetArchitecture (<br>
#3  lldb_private::Module::<u></u>GetObjectFile (<br>
#4  lldb_private::ModuleList::<u></u>GetSharedModule (<br>
#5  lldb_private::PlatformKalimba:<u></u>:ResolveExecutable (<br>
#6  lldb_private::TargetList::<u></u>CreateTarget (<br>
<br>
As you can see GSHI gets called again with a non-empty section list when the platform tries to resolve the executable.<br>
<br>
<br>
Please note that I copied a lot of the PlatformLinux code into PlatformKalimba. So the behaviour I see is not specific to my kalimba implementation: loading a linux ELF built for x86_64 execution does the same thing:<br>

<br>
do:<br>
<br>
(lldb) target create ~/src/../simple/i64-hello.elf<br>
<br>
with a breakpoint here in ObjectFileELF::GSHI:<br>
<br>
    if (!section_headers.empty())<br>
-->   return section_headers.size();<br>
<br>
you'll see this call stack at some stage:<br>
#0  ObjectFileELF::<u></u>GetSectionHeaderInfo (section_headers=std::vector of length 35<br>
#1  ObjectFileELF::<u></u>ParseSectionHeaders (<br>
#2  ObjectFileELF::GetArchitecture (<br>
#3  lldb_private::Module::<u></u>GetObjectFile (<br>
#4  lldb_private::ModuleList::<u></u>GetSharedModule (<br>
#5  lldb_private::PlatformLinux::<u></u>ResolveExecutable (<br>
#6  lldb_private::TargetList::<u></u>CreateTarget (<br>
<br>
It would be great if we could prevent the arch_spec being modified again, after the headers are parsed. Either with my patch or something similar. Anyway, I'm off now, so I'll catch up sometime tomorrow.<br>
<br>
thanks<br>
Matt<div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <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>
</div>