Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353726 - Make ISection API, propagate information on executability and physical addresses
Summary: Make ISection API, propagate information on executability and physical addresses
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ken Ryall CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-03 05:40 EDT by Daniel Thomas CLA
Modified: 2012-05-22 20:37 EDT (History)
2 users (show)

See Also:


Attachments
Patch to add this functionality. Relies on patch in bug 353577 but this dependency can be removed. (44.81 KB, patch)
2011-08-03 05:42 EDT, Daniel Thomas CLA
cdtdoug: iplog+
Details | Diff
Patch adding this functionality and using properties in IExecutableSection (30.59 KB, patch)
2011-08-08 06:25 EDT, Daniel Thomas CLA
no flags Details | Diff
Patch adding this functionality and using properties in IExecutableSection and ISymbol (32.84 KB, patch)
2011-08-09 08:55 EDT, Daniel Thomas CLA
cdtdoug: iplog+
Details | Diff
Patch adding this functionality using properties and assuming IAddressInterval tests (33.83 KB, patch)
2011-08-10 04:30 EDT, Daniel Thomas CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Thomas CLA 2011-08-03 05:40:45 EDT
Build Identifier: 

When working with ISymbols, ISections and IExecutableSections it is useful to know various properties about them such as whether they are executable, allocatable and what their physical address is (in some circumstances the difference between this and the virtual address is important).
Some of this information is determined by the membership of a smaller object such as ISymbol of a larger one such as IExecutableSection hence adding support for getting the containing section for a symbol and the containing ISection for a IExecutableSection is useful. It also allows access to the physical address which is only known for the ISection.

Hence ISection needs to be made API so that it can be returned and various methods added.

I have a patch which adds this functionality.

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-03 05:42:37 EDT
Created attachment 200787 [details]
Patch to add this functionality. Relies on patch in bug 353577 but this dependency can be removed.
Comment 2 Kirk Beitz CLA 2011-08-06 07:00:59 EDT
(In reply to comment #0)
> When working with ISymbols, ISections and IExecutableSections it is useful to
> know various properties about them such as whether they are executable,
> allocatable and what their physical address is (in some circumstances the
> difference between this and the virtual address is important).
> Some of this information is determined by the membership of a smaller object
> such as ISymbol of a larger one such as IExecutableSection hence adding support
> for getting the containing section for a symbol and the containing ISection for
> a IExecutableSection is useful. It also allows access to the physical address
> which is only known for the ISection.
> 
> Hence ISection needs to be made API so that it can be returned and various
> methods added.

having internally discussed this issue and the promotion of ISection from internal to API level interface within EDC, i am not opposed on principle.  however ...

the description of this issue mentions properties.  note that ISection already has a getProperties() method interface.

a more consistent, forward-looking approach would be to add a getProperties() function to IExecutableSection (preventing IExecutableSection implementations for other executable formats from having to implement methods that aren't germane, and also stabilizing the API).  there's nothing preventing an implementation of IExecutableSection from holding a property list that contains an Object instanceof ISection with the key "CONTAINER", where another IExecutableSection implementation could simply wouldn't have to set this property, or any of the other attributes that are not pertinent.

such an approach would also thus mean ISection wouldn't have to be promoted solely so it could be used as a return type in an API-level method interface.
Comment 3 Daniel Thomas CLA 2011-08-08 06:25:12 EDT
Created attachment 201069 [details]
Patch adding this functionality and using properties in IExecutableSection

Still depends on 353577 but that should hopefully be committed soon.

This patch still uses isExecutable, isData, isNotTextOrData methods in ISymbol but this is consistent with for example isThumb in ARMSymbol. If you think that ISymbol should use properties as well then I can produce a patch which does that.
Comment 4 Kirk Beitz CLA 2011-08-08 14:27:20 EDT
(In reply to comment #3)
> This patch still uses isExecutable, isData, isNotTextOrData methods in ISymbol
> but this is consistent with for example isThumb in ARMSymbol. If you think that
> ISymbol should use properties as well then I can produce a patch which does
> that.

yes, i can see from my original comment that i didn't specify that.  i was thinking that it would be best to use a getProperties() method interface in ISymbol as well, for similar reasons.
Comment 5 Daniel Thomas CLA 2011-08-09 08:55:34 EDT
Created attachment 201136 [details]
Patch adding this functionality and using properties in IExecutableSection and ISymbol
Comment 6 Kirk Beitz CLA 2011-08-09 18:44:58 EDT
using the latest patch (merged with other changes), this test is now failing the TestAddressInterval JUnit test for me.  i can change the values in TestAddressInterval to make it work a little better, but i was wondering if you had separately updated TestAddressInterval after applying this patch?
Comment 7 Daniel Thomas CLA 2011-08-10 04:30:31 EDT
Created attachment 201214 [details]
Patch adding this functionality using properties and assuming IAddressInterval tests

(In reply to comment #6)
> I was wondering if you had separately updated TestAddressInterval after
> applying this patch?

Sorry yes. I am producing my patches against current EDC master and since EDC master doesn't have TestIAddressInterval yet my changes to it didn't have anywhere to go (though I should have noticed that). Attached is a patch which assumes that TestIAddressInterval exists and is in the place I expect it to be from my tree and submitted patch (though I think you have moved it in your tree but I can't see that to check).
Comment 8 Kirk Beitz CLA 2011-08-11 03:19:16 EDT
(In reply to comment #7)
> Attached is a patch which
> assumes that TestIAddressInterval exists and is in the place I expect it to be
> from my tree and submitted patch (though I think you have moved it in your tree
> but I can't see that to check).

thanks.  this patch (with a minor tweak after making getHighAddress() a @Test, has been committed to our local repository.