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

Bug 353601

Summary: In DwarfCompileUnit#getChildren() ensure that the compile unit is parsed before returning results
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: minor    
Priority: P3 CC: cdtdoug, kirk.beitz
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch that ensures that the compile unit is parsed.
cdtdoug: iplog+
Add test case (uses lots of memory if Bug 353558 is not fixed)
none
Add test case
cdtdoug: iplog+
replcement DwarfCompileUnit patch removing problematic call to ensureParsdForAddresses() cdtdoug: iplog+

Description Daniel Thomas CLA 2011-08-02 11:06:25 EDT
Build Identifier: 

If the compile unit is not parsed before the results are returned then an empty collection may be returned if there are in fact children. This results in the behavior of getChildren() being inconsistent depending on whether or not getFunctions() has been called yet or not.

I have a patch which adds support for ensuring that parsing has occurred before results are returned. It also fixes up the compile unit ranges having done that as parsing can result in our knowing better what the compile unit ranges are.

Workaround: when calling getChildren() on a IScope first test if it is an instance of ICompileUnitScope and if it is call getFunctions() on that and discard any results. Then when getChildren() is called the compile unit will have been parsed.

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-02 11:06:50 EDT
Created attachment 200726 [details]
Patch that ensures that the compile unit is parsed.
Comment 2 Daniel Thomas CLA 2011-08-04 08:21:00 EDT
Created attachment 200911 [details]
Add test case (uses lots of memory if Bug 353558 is not fixed)
Comment 3 Kirk Beitz CLA 2011-08-05 21:09:57 EDT
daniel, i believe you have left out the AbstractDwarfReaderTest in oversight, because i do not see it in the test case attachment for this bugzilla issue or any of the others you've submitted recently.

the code change (without the test) has been committed and nominally tested in our local repository and is awaiting final review and merge to the eclipse edc git repository by committer Ken Ryall.
Comment 4 Kirk Beitz CLA 2011-08-05 21:18:55 EDT
(In reply to comment #3)
> the code change (without the test) has been committed and nominally tested in
> our local repository and is awaiting final review and merge to the eclipse edc
> git repository by committer Ken Ryall.

actually, looking at the results more closely, there is a regression with the gcce compiler symbolics in our JUnit tests in combination with the other already committed changes.  i will re-review this patch, but it's not being committed to our local source base until i can investigate further.
Comment 5 Kirk Beitz CLA 2011-08-06 19:07:44 EDT
perhaps this patch was partially dependent upon another of the recent patches being applied at the same time.  with almost all of the rest of the patches recently applied together with this one, the regression no longer occurs.

as such, the patch has now indeed been finally committed to our local source repository, and is pending final review and merge to the eclipse edc git repository by committer ken ryall.
Comment 6 Daniel Thomas CLA 2011-08-08 04:21:58 EDT
Created attachment 201055 [details]
Add test case

This time including all three necessary commits rather than just the last one.
Comment 7 Kirk Beitz CLA 2011-08-08 14:18:06 EDT
moved @Test items testSymFromExeDetect and testSymDetect back into original TestDwarfReader.

renamed Bug_353601 to testDwarfCompileUnitChildren, and moved it to org.eclipse.cdt.debug.edc.tests with other such tests

there was some merging/re-refactoring based on other changes we had made to our local version of TestDwarfReader that were pending merge with the eclipse edc git repository.

altogether, the test patch has now been nominally tested in our local source base, and is now part of the pending merge.
Comment 9 Kirk Beitz CLA 2011-09-01 17:30:31 EDT
Created attachment 202643 [details]
replcement DwarfCompileUnit patch removing problematic call to ensureParsdForAddresses()

(In reply to comment #8)
> Fixed in:
> http://git.eclipse.org/c/cdt/org.eclipse.cdt.edc.git/commit/?id=f7c4790c134d0cdc30cdbe8d2a016bf27cd25528

daniel, we've encountered a different regression that is solved by removing a portion of the original patch from the code.

we have tested the AllEDCTests JUnit with this suite, and it performs without failures, including the changes to TestDwarfReader in the previous patches.

the new attachment is a patch from our local cvs repository that should make it plain what we've changed.

can you test this patch against your local source-base with all of the other recent changes to the eclipse edc git repository and let us know if this will work for you?