Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353577

Summary: Add support for polymorphicly operating over multiple objects describing memory regions
Product: [Tools] CDT Reporter: Daniel Thomas <daniel.thomas>
Component: cdt-debug-edcAssignee: Ken Ryall <ken.ryall>
Status: RESOLVED FIXED QA Contact: Ken Ryall <ken.ryall>
Severity: enhancement    
Priority: P3 CC: cdtdoug, kirk.beitz
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=353904
Whiteboard:
Attachments:
Description Flags
Patch to add and use IAddressInterval and HasSize interfaces
none
Tests for IAddressInterval and HasSize
cdtdoug: iplog+
Patch to add and use IAddressInterval and HasSize interfaces cdtdoug: iplog+

Description Daniel Thomas CLA 2011-08-02 09:33:40 EDT
Build Identifier: I20110613-1736

When working with lots of the classes which represent regions of memory such as IExecutableSection, IScope, ISection and ISymbol it is useful to be able to write code which can use any one of those as they have common methods.

I have a patch which adds an IAddressInterval interface which collects together these common methods and adds a HasSize interface as this a method not supported by all (as the concept of size doesn't always hold).

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-02 09:42:56 EDT
Created attachment 200713 [details]
Patch to add and use IAddressInterval and HasSize interfaces
Comment 2 Daniel Thomas CLA 2011-08-04 10:01:13 EDT
Created attachment 200917 [details]
Tests for IAddressInterval and HasSize

These reveal a couple of bugs which will be reported separately.
Comment 3 Daniel Thomas CLA 2011-08-04 11:26:52 EDT
Created attachment 200927 [details]
Patch to add and use IAddressInterval and HasSize interfaces

Additionally copes with cases where there is no buffer available to provide the size information (which makes the provided tests pass).
Comment 4 Kirk Beitz CLA 2011-08-05 14:09:47 EDT
this patch seems mostly quite useful.

in our local code base, i've refactored this a little further to add AbstractAddressInterval for use by methods, since getLowAddress(), getHighAddress() and hasEmptyRange() is highly similar for several of the implementers.

this code has now been nominally tested locally; awaiting final review and final merge to eclipse edc git repository by committer ken ryall.
Comment 5 Kirk Beitz CLA 2011-08-05 14:22:35 EDT
i've also slightly modified the test patch to live in org.eclipse.cdt.debug.edc.tests for now.

if/when package org.eclipse.cdt.debug.edc.symbol.tests gets created, there are probably a number of the tests in org.eclipse.cdt.debug.edc.tests that would get moved there as well.