[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 11 11:07:11 PST 2018


The current behavior is definitely correct.  An Address without a section is generally going to be something like a stack or heap address.  Those definitely have load addresses of whatever their value is.

I'm not sure what it means to have a file address represented as an offset not a section with offset.  That might end up matching some address in an object file on load, but that's entirely an accident from lldb's perspective.  Can you not make this as a section relative thing when it is a file address?

Jim


> On Dec 11, 2018, at 10:42 AM, Pavel Labath <pavel at labath.sk> wrote:
> 
> On 11/12/2018 19:17, Jim Ingham wrote:
>> It the section isn't in the target's SectionLoadList, then GetLoadAddress should return LLDB_INVALID_ADDRESS.  I.e. this bit from Section::GetLoadBaseAddress:
>>     load_base_addr = target->GetSectionLoadList().GetSectionLoadAddress(
>>         const_cast<Section *>(this)->shared_from_this());
>> should return LLDB_INVALID_ADDRESS because the section isn't in the load list.
>> Are we putting sections in the target's section load list before we've actually seen them loaded.  I'm pretty sure we shouldn't do that.
>> Jim
> 
> The issue here is that the Address object in question is not backed by any section. It has a null section, and just an offset member.
> In this case Address::GetLoadAddress just decides to return that address as a load address, which I imagine is correct in some situations, but in this case our intention was for this address to represent a file address (which would still need to be adjusted to account for where the module ended up being loaded).
> 
> 



More information about the lldb-commits mailing list