Bug 167895

Summary: [expr] debugger specific watch expressions
Product: [Eclipse Project] Platform Reporter: B. Drost <bertram.drost>
Component: DebugAssignee: Platform-Debug-Inbox <platform-debug-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: darin.eclipse, pawel.1.piech, sw
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description B. Drost CLA 2006-12-13 13:43:47 EST
Build ID: M20060629-1905

Steps To Reproduce:
Enter the debug view. Open two debug sessions, a JAVA-Session J and some other session (non-java) D (for example C/C++). write some expressions that can be evaluated in D but not in J (eg. using C/C++ only constructs). The problem: Eclipse reports errors when both are suspended and one changes the focus (==klicking to a stackframe) from D (where the expressions are evaluated correctly) to J (where they cannot be evaluated, when it should just silently mark them "invalid" (red).




More information:
I traced that down to the class org.eclipse.debug.internal.core.WatchExpression:

Eclipse calls the "setExpressionContext()" method, since the context was changed from D to J. This in turn calls "evaluate" for reciving the result of the expression from J. However, the old value of the expression, obtained by D, is still stored in fResult.

Now when "evaluate()" calls "setPending()", a watchExpressionChanged is fired, and since J already registered for that, it calls "getValue()" (The call comes from "JDIModelPresentation.getExpressionText()"). getValue() however will return the _old_ value stored in fResult (This might be a race condition), and since that old value is some class from my own debugger D, J gets confused and throws an error.

IMHO, WatchExpression.setPending(true) should set fResult to null to invalidate the old result.
Comment 1 Darin Wright CLA 2006-12-13 13:55:16 EST
*** Bug 167896 has been marked as a duplicate of this bug. ***
Comment 2 Darin Wright CLA 2006-12-13 13:56:07 EST
*** Bug 167897 has been marked as a duplicate of this bug. ***
Comment 3 Darin Wright CLA 2006-12-13 13:57:22 EST
*** Bug 167898 has been marked as a duplicate of this bug. ***
Comment 4 Darin Wright CLA 2006-12-13 13:57:43 EST
*** Bug 167899 has been marked as a duplicate of this bug. ***
Comment 5 Darin Wright CLA 2008-05-02 14:35:17 EDT
Future enhancement request. Currently, watch expressions are just text and are not bound to any language/nature/debugger. We'd need to have the ability to bind an expression to a language/nature for this to work, and for expression evaluation delegates to also be bound/apply to certain natures.