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

2019-02-11 Thread Pavel Labath via Phabricator via lldb-commits
labath abandoned this revision. labath added a comment. This has been implemented for ELF in another way. PECOFF changes are waiting for review in D58050 . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55356/new/ https://reviews.llvm.org/D55356

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

2018-12-12 Thread Pavel Labath via lldb-commits
On 11/12/2018 23:54, Zachary Turner wrote: On Tue, Dec 11, 2018 at 11:57 AM Pavel Labath > wrote: The part I know nothing about is whether something similar could be done for PE/COFF files (and I'll need something like that there too). Adrian,

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

2018-12-11 Thread Zachary Turner via lldb-commits
On Tue, Dec 11, 2018 at 11:57 AM Pavel Labath wrote: > The part I know nothing about is whether something similar could be done > for PE/COFF files (and I'll need something like that there too). Adrian, > Zachary, what is the relation ship between "image base" of an object > file and its

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

2018-12-11 Thread Greg Clayton via lldb-commits
> On Dec 11, 2018, at 11:58 AM, Pavel Labath wrote: > > On 11/12/2018 20:39, Jim Ingham wrote: >> Sections can have parents. In MachO the text and data sections are actually >> contained in the TEXT and DATA segments respectively. LLDB represents this >> by having an lldb_private::Section

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

2018-12-11 Thread Jim Ingham via lldb-commits
In MachO a segment fully contains its sections and a section can only be in one segment. I don't remember how much the lldb Section nesting code enforces this. It would be weird to have two Sections at the same level overlap, I don't see any "GetSectionsForAddress(lldb::addr_t address)" API's

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

2018-12-11 Thread Pavel Labath via lldb-commits
On 11/12/2018 20:39, Jim Ingham wrote: Sections can have parents. In MachO the text and data sections are actually contained in the TEXT and DATA segments respectively. LLDB represents this by having an lldb_private::Section for the segment, and then all the sections in that segment are

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

2018-12-11 Thread Jim Ingham via lldb-commits
Sections can have parents. In MachO the text and data sections are actually contained in the TEXT and DATA segments respectively. LLDB represents this by having an lldb_private::Section for the segment, and then all the sections in that segment are children of the parent Section (the MachO

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

2018-12-11 Thread Pavel Labath via lldb-commits
On 11/12/2018 20:10, Jim Ingham via Phabricator wrote: jingham added a comment. In D55356#1327280 , @clayborg wrote: In D55356#1327242 , @labath wrote: In D55356#1327224

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

2018-12-11 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment. In D55356#1327280 , @clayborg wrote: > In D55356#1327242 , @labath wrote: > > > In D55356#1327224 , @clayborg > > wrote: > > > > > In

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

2018-12-11 Thread Jim Ingham via lldb-commits
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

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

2018-12-11 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment. In D55356#1327242 , @labath wrote: > In D55356#1327224 , @clayborg wrote: > > > In D55356#1327099 , @labath wrote: > > > > > Actually, this now

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

2018-12-11 Thread Pavel Labath via lldb-commits
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(

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

2018-12-11 Thread Jim Ingham via lldb-commits
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(this)->shared_from_this()); should return

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

2018-12-11 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. In D55356#1327224 , @clayborg wrote: > In D55356#1327099 , @labath wrote: > > > Actually, this now causes an lldb-mi test to fail, but it's not clear to me > > if the problem is in the

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

2018-12-11 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment. In D55356#1327224 , @clayborg wrote: > In D55356#1327099 , @labath wrote: > > > Actually, this now causes an lldb-mi test to fail, but it's not clear to me > > if the problem is in the

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

2018-12-11 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment. In D55356#1327099 , @labath wrote: > Actually, this now causes an lldb-mi test to fail, but it's not clear to me > if the problem is in the test, or this patch. This issue happens when lldb-mi > is printing the "library loaded"

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

2018-12-11 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. Actually, this now causes an lldb-mi test to fail, but it's not clear to me if the problem is in the test, or this patch. This issue happens when lldb-mi is printing the "library loaded" message after a module gets added to a not-yet-running target. It tries to print

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

2018-12-11 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 177717. labath added a comment. Rebase after comitting D55422 . Now this patch just implements GetBaseAddress for ELF and PECOFF object files, and adds tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55356/new/

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

2018-12-07 Thread Pavel Labath via Phabricator via lldb-commits
labath planned changes to this revision. labath added a comment. In D55356#1321863 , @clayborg wrote: > This is already available with: > > virtual lldb_private::Address ObjectFile::GetHeaderAddress(); > > > It return a lldb_private::Address which is

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

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments. Comment at: include/lldb/Symbol/ObjectFile.h:569 + /// Returns the base file address of an object file (also known as the + /// preferred load address or image base address). This is typically the file lemo wrote: > "file

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

2018-12-06 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo added inline comments. Comment at: include/lldb/Symbol/ObjectFile.h:569 + /// Returns the base file address of an object file (also known as the + /// preferred load address or image base address). This is typically the file "file address" can mean an

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

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment. Marked as requesting changes in case "GetBaseFileAddress() == GetHeaderAddress().GetFileAddress()" in all cases. If the base file address differs from where the object file header is located, then this change would work. Else we should use GetHeaderAddress() and

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

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. This is already available with: virtual lldb_private::Address ObjectFile::GetHeaderAddress(); It return a lldb_private::Address which is section offset, but nothing stopping

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

2018-12-06 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth accepted this revision. amccarth added a comment. This revision is now accepted and ready to land. LGTM. Comment at: lit/Modules/MachO/basic-info.yaml:10 +# CHECK: Strata: user +# CHECK: Base VM address: 0x1 + Just so I understand, this

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

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision. labath added reviewers: clayborg, zturner, lemo. Herald added subscribers: arichardson, emaste. Herald added a reviewer: espindola. Object files generally have a "base" address, which is their preferred address to be loaded into memory (in the sense that if they are