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

Bug 355501

Summary: Make mergeRangeList cope with overlapping scopes and fix mergeScopeRange to correctly create ranges
Product: [Tools] CDT Reporter: Daniel Thomas <daniel.thomas>
Component: cdt-debug-edcAssignee: Ken Ryall <ken.ryall>
Status: RESOLVED WONTFIX QA Contact: Ken Ryall <ken.ryall>
Severity: normal    
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=353605
Whiteboard:
Attachments:
Description Flags
Patch to do all this
none
Patch to do all this and add sort method so that this happens correctly none

Description Daniel Thomas CLA 2011-08-23 09:41:27 EDT
Build Identifier: 

Scope#mergeScopeRange does not correctly update the Scope's IRangeList if one needs to be created or if a range needs to be added which is not above or below the current range covered by a Scope (i.e. between low and high address).
RangeList#add{Low,High}Range(long) do not work correctly as they assume that the RangeList is sorted and if it is not then they don't lower the lowest entry's low but some other entries low resulting in an inconsistent RangeList
RangeList#mergeRangeList does not work well if the scopes it is merging overlap at all.
FunctionScopes do not merge in added children and so a hack is required in DwarfInfoReader to move the low and high addresses which can be removed if instead the merge is performed.

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-23 09:42:07 EDT
Created attachment 201996 [details]
Patch to do all this
Comment 2 Kirk Beitz CLA 2011-08-24 15:11:15 EDT
regarding the TODO in the patch in mergeRangeLists … 

first, i wonder why RangeList is historically buried in .internal.symbols.dwarf as opposed to residing in .internal.symbols .

second, i wonder if this would be a good opportunity to create something like ...edc.internal.symbols.IOrderedRangeList extends SortedSet<IRangeList.Entry>  and ...edc.internal.symbols.OrderedRangeList implements IOrderedRangeList …

in this way, ultimately, mergeRangeLists could be guaranteed to work on ordered range lists, and the implementation would provide the benefits of doing the ordering so long as the Comparator is sufficient.

and it would be obviously available to all symbols formats, not just those that know RangeLists.java is in .internal.symbols.dwarf .
Comment 3 Daniel Thomas CLA 2011-08-25 05:35:36 EDT
Created attachment 202129 [details]
Patch to do all this and add sort method so that this happens correctly

(In reply to comment #2)
> regarding the TODO in the patch in mergeRangeLists … 
> 
> first, i wonder why RangeList is historically buried in .internal.symbols.dwarf
> as opposed to residing in .internal.symbols .

Yes it might be worth moving it (though I haven't done that in the updated patch)

> second, i wonder if this would be a good opportunity to create something like
> ...edc.internal.symbols.IOrderedRangeList extends SortedSet<IRangeList.Entry> 
> and ...edc.internal.symbols.OrderedRangeList implements IOrderedRangeList …

Unfortunately the kind of sorting required is not that that standard sort methods will do as it also needs to merge adjacent/overlapping entries and remove zero length ones. (See the patch for an implementation which does that)

[snip]
Comment 4 Jonah Graham CLA 2019-12-30 18:39:40 EST
(this is part of a batch change)

The Eclipse CDT EDC (https://wiki.eclipse.org/CDT/cdt-debug-edc) is now obsolete and has not had any active development since 2011. Therefore the still open bugs are being marked as wontfix.

The git repo for the project still exists for posterity at https://git.eclipse.org/c/cdt/org.eclipse.cdt.edc.git/