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

Bug 173898

Summary: [logical structures] Stepping with logical structure expanded results in blank labels
Product: [Eclipse Project] Platform Reporter: Curtis Windatt <curtis.windatt.public>
Component: DebugAssignee: Curtis Windatt <curtis.windatt.public>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P2 CC: benno.baumgartner, bokowski, chanskw, eclipse, markus.kell.r, n.a.edgar
Version: 3.3   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Screenshot
none
Patch to cache logical structures in the java debugger.
none
work in progress
none
updated patch
none
updated patch none

Description Curtis Windatt CLA 2007-02-12 13:43:07 EST
Build ID:  I20070209-1006

When debugging a class with a Vector or another type with a logical structure, expand the variable (with logical structures turned on).  Step over some code that modifies the variable.  Some labels will be blank.

Refreshing the view by changing the stack trace selected will fix it.
Comment 1 Curtis Windatt CLA 2007-02-12 13:46:26 EST
Created attachment 58789 [details]
Screenshot

Screenshot showing blank variable labels.
Comment 2 Curtis Windatt CLA 2007-02-12 13:57:12 EST
Investigated with Darin.

When displaying a variable with a logical structure, the variable's value is replaced by a value created by the logical structure code.  Each time a step occurs, the value object is created (resulting in a different instance each step).

Possible cause of the problem is that the view is being asked to remove/change children of a parent it doesn't know about.  The view has a instance of a value (A) with several children.  When the step occurs, a new value (B) is created, having different children.  The view is asked to remove/change the children of (B), but the view only knows about (A).  The view doesn't know that (A) and (B) are equal.

Comment 3 Darin Wright CLA 2007-02-12 15:59:43 EST
Looks like a dup of bug 173571. During the refresh an element is replaced, which causes it 'hasChildren' to be updated. However, when we call back with 'setHasChildren(true)', no further refreshing is done on that node because it is already expanded.

*** This bug has been marked as a duplicate of bug 173571 ***
Comment 4 Darin Wright CLA 2007-02-12 16:20:32 EST
Re-opening. The patch in bug 173571 does not fix our problem completely.
Comment 5 Darin Wright CLA 2007-02-12 16:22:47 EST
Although the child count is updated, the children are not refreshed properly. It looks like the following happens...

- element A is refreshed
- A's children are expanded so they are refreshed
- we asynchronously replace A with B
- the 'hasChildren' of B is updated (still true)
- with the patch in bug 173571, the child count of B is updated
- the children of B are not refreshed even though it was replaced
Comment 6 Darin Wright CLA 2007-02-14 12:07:31 EST
Created attachment 58979 [details]
Patch to cache logical structures in the java debugger.

Makes Java logical structures more efficient - otherwise they are computed multiple times for each element (child count, and each child subrange retrieved).
Comment 7 Darin Wright CLA 2007-02-16 11:48:45 EST
*** Bug 174461 has been marked as a duplicate of this bug. ***
Comment 8 Darin Wright CLA 2007-03-16 16:12:19 EDT
One problem seems to be that when a non-leaf node in the tree is replaced, its children elements are not cleared. So we are not asked to update the children of the node that have allready been revealed.

So, when the root node of the var view is first refreshed, all items are cleared which asks us to update all elements in the tree. We are asked to update the previous elements, which may no longer exist. For example, the elements in a logical structure are replaced on each step. So we are asked to update the old elements, and when we replace with the new elements asynchronously, the already retrieved children do not get re-retrieved.
Comment 9 Darin Wright CLA 2007-03-23 15:31:21 EDT
*** Bug 175062 has been marked as a duplicate of this bug. ***
Comment 10 Darin Wright CLA 2007-04-02 17:49:45 EDT
Created attachment 62724 [details]
work in progress
Comment 11 Darin Wright CLA 2007-04-03 11:34:23 EDT
Created attachment 62792 [details]
updated patch

Also fixes bug in filter transform.
Comment 12 Darin Wright CLA 2007-04-03 15:43:16 EDT
Created attachment 62822 [details]
updated patch

Updated patch, fixes bug in request scheduling.
Comment 13 Darin Wright CLA 2007-04-03 16:40:56 EDT
Released fix to HEAD.

This changes the way the tree retrieves content. We don't process a request for a node's content until its parent's content has been retrieved. This avoids retrieving content for deeper nodes that no longer exist in the tree, when the initial refresh is started.

As well, our tree viewer overrides 'replace(...)' from the JFace tree viewer, to "clearAll" children items when an item is replaced/re-mapped. I think our fix can be removed when bug 172640 is fixed.
Comment 14 Darin Wright CLA 2007-04-03 16:41:34 EDT
Please verify, Curtis. Changes to:

ChildrenCountUpdate.java
ChildrenUpdate.java
FilterTransform.java
HasChildrenUpdate.java
InternalTreeModelViewer.java
ModelContentProvider.java
TreeModelContentProvider.java
ViewerUpdateMonitor.java
Comment 15 Curtis Windatt CLA 2007-04-04 12:39:19 EDT
Verified

There is a bit of flashing, but it is far better than blank labels.
Comment 16 Darin Wright CLA 2007-04-17 22:27:45 EDT
*** Bug 168601 has been marked as a duplicate of this bug. ***
Comment 17 Darin Wright CLA 2007-04-23 12:14:49 EDT
*** Bug 169968 has been marked as a duplicate of this bug. ***