Bug 126262 - Manual change in Memory or Variables view is not propagated to Expressions view
Summary: Manual change in Memory or Variables view is not propagated to Expressions view
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M7   Edit
Assignee: Ken Ryall CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-02-02 15:46 EST by Ling Wang CLA
Modified: 2008-06-20 11:26 EDT (History)
2 users (show)

See Also:


Attachments
Ling's partial fix to the bug (2.86 KB, patch)
2007-05-02 20:04 EDT, Ling Wang CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ling Wang CLA 2006-02-02 15:46:12 EST
Suppose you have variable "int i" in your program. During debug, 
1. Add "memory monitor" on "&i". Then you should see value of "i" in the memory pane.
2. Change the value of the memory word for "i" in the memory pane.
3. Now you can see the value of "i" in Variable View does not change accordingly while it should.
Similarly the change is not reflected in Expression View if you have expression "i" in it.
On the other hand, manual change to value of "i" in Variable View is not propagated to memory view. 

In general, this is an issue on how to synchronize value display between Variable, Expression, Memory and Register views.
Comment 1 Samantha Chan CLA 2006-02-02 16:09:08 EST
Are you using CDT?

I believe this this a CDT problem.  When the memory block is changed, CDT should fire a change events on its variables, expressions and registers since they can all potentially changed.

Similarly, when user change the value of a variable, CDT needs to fire a change event on the memory block to ensure that the Memory View is updated.

Thanks...
Samantha
Comment 2 Ling Wang CLA 2006-02-02 16:36:15 EST
Yes, I'm using CDT. And I also tend to think it's a CDT bug. But I was not sure so I logged it against the platform. 
I've changed "Product" of this entry to "CDT".
Comment 3 Nobody - feel free to take it CLA 2006-02-02 16:44:24 EST
The synchronization between the Memory and Variables views has been fixed in 3.0.2. The problem still exists for the Expressions view.
Comment 4 Ling Wang CLA 2006-02-02 17:18:32 EST
As to the problem with Expression View, I believe it's easier to handle now with bug #125783(https://bugs.eclipse.org/bugs/show_bug.cgi?id=125783) fixed in platform. 
Comment 5 Nobody - feel free to take it CLA 2006-02-02 17:46:56 EST
(In reply to comment #4)
> As to the problem with Expression View, I believe it's easier to handle now
> with bug #125783(https://bugs.eclipse.org/bugs/show_bug.cgi?id=125783) fixed in
> platform. 
We'll see. The problem is that we don't have access to IWatchExpression to notify it that something has changed. Actually, the problem occurs only for the top level elements of the view. If expression is a pointer to a structure, the members of the structure are updated.
Comment 6 Ling Wang CLA 2007-05-02 20:04:54 EDT
Created attachment 65708 [details]
Ling's partial fix to the bug
Comment 7 Ling Wang CLA 2007-05-02 20:08:43 EDT
I created a patch to partially fix the bug. 
It makes CDT behavior in line with JDT. Namely after a var is changed, on next redraw of the Expression view (e.g. after stepping, or when the view is uncovered from background), the change will show up in the view.

The remaining problem (with both CDT & JDT) is: 
Due to platform bug, the change will not show up in Expression View until the view is redrawn . In other words, if the Expression View is at the front (not covered) when the variable is changed, the change won't be reflected in the view.
Comment 8 John Cortell CLA 2007-05-03 17:06:01 EDT
Ling, back in February, I contributed a mechanism in CDT to cause a change in the memory view to propagate to the variables view and registers view (not sure at the moment if the same holds true for the expression view). See 172508. If that doesn't handle all your uses cases, you may want to look at expanding on that mechanism. It does require a CDI client to implement a new interface.
Comment 9 Ling Wang CLA 2007-05-04 01:16:40 EDT
(In reply to comment #8)
John, I noticed your addition. My patch is to make sure the expressions listen to and handle variable change event. I tried implementing your new interface of ICDITargetConfiguration3 in our CDI plugin and it surely works. 
Actually there are more pending issues in this category, say, variable change should also be propagated to Memory View, but we don't want variable & memory block listen to each other and ends up in infinite notification loop. Anyway, I plan to investigate more on that later.
Comment 10 John Cortell CLA 2007-05-04 09:29:18 EDT
Actually, this whole matter of something in one view affecting others is quite messy. Here's another scenario. User changes a value in the Registers view that affects one or more variables. The other way is easier to handle; the CDI client knows what register a variable is associated with, so if the user changes the variable value, the client can send a corresponding change notification for the affected register. But the opposite is much trickier. And there are even more complicated scenarios. Seems to me in most cases, the only way to provide dependable synchronization between some of these views is to ask for a complete refresh. For example, the client would need to tell CDT: if the user changes a register value, all bets are off in the Variables view. Re-fetch all elements. This is brutally inefficient, but it seems to me the coordination and logic required to avoid it (and still provide dependably synchronization) is unreasonable for some debugger engines. 

An alternative is to give the user the ability to do a re-fetch and refresh in a view. If he suspects he's done something in one view that has invalidated the display in another, he at least has the ability to tell the debugger to update its view.
Comment 11 Ken Ryall CLA 2007-05-05 17:06:45 EDT
My understanding of the discussion now is that we hold off on this change while Ling looks at using the new support John added to cover the case where the Expressions view (and probably others) need to respond to changes in the Variables view. Let me know if that's not correct.
Comment 12 Ling Wang CLA 2007-05-07 01:53:39 EDT
(In reply to comment #11)
John's addition is to make sure any change in memory view is propagated to variable view & register view, whereas mine patch is to make sure variable change in propagated to Expression view. So Ken, it's fine you commit my patch which is at least a step forward. 
My discussion with John is mainly about how to the broader scope issue, namely how to sync all debug data views when user changes something in one view.


Comment 13 Ken Ryall CLA 2007-05-09 23:33:03 EDT
OK, I applied the patch and will mark this case fixed.