Todd Fiala wrote:
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.

It is still useful as a fallback if the notes are not present.

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.

Hi Todd,

Yup, It would be cool if you could take a look.

When I invoke "target create kalimba.elf" I actually see ObjectFileELF::GetSectionHeaderInfo called *several times* whilst the target is created:

The first time...

#0 ObjectFileELF::GetSectionHeaderInfo (section_headers=std::vector of length 0, capacity 0, object_data=...,
#1 ObjectFileELF::GetModuleSpecifications
#2  lldb_private::ObjectFile::GetModuleSpecifications (overloaded function)
#3  lldb_private::ObjectFile::GetModuleSpecifications
#4  lldb_private::TargetList::CreateTarget

It is subsequently called again like this:

#0 ObjectFileELF::GetSectionHeaderInfo (section_headers=std::vector of length 18,
#1  ObjectFileELF::ParseSectionHeaders (
#2  ObjectFileELF::GetArchitecture (
#3  lldb_private::Module::GetObjectFile (
#4  lldb_private::ModuleList::GetSharedModule (
#5  lldb_private::PlatformKalimba::ResolveExecutable (
#6  lldb_private::TargetList::CreateTarget (

As you can see GSHI gets called again with a non-empty section list when the platform tries to resolve the executable.


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:

do:

(lldb) target create ~/src/../simple/i64-hello.elf

with a breakpoint here in ObjectFileELF::GSHI:

    if (!section_headers.empty())
-->   return section_headers.size();

you'll see this call stack at some stage:
#0 ObjectFileELF::GetSectionHeaderInfo (section_headers=std::vector of length 35
#1  ObjectFileELF::ParseSectionHeaders (
#2  ObjectFileELF::GetArchitecture (
#3  lldb_private::Module::GetObjectFile (
#4  lldb_private::ModuleList::GetSharedModule (
#5  lldb_private::PlatformLinux::ResolveExecutable (
#6  lldb_private::TargetList::CreateTarget (

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.

thanks
Matt


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.
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to