Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Ryall2006-11-08 22:22:40 +0000
committerKen Ryall2006-11-08 22:22:40 +0000
commitdc0cd6d731b1e0b838fa2e0f234e9d9d5fb8fbdc (patch)
treeb9d28becfb27618d4f5e23a8db31c8932a6e60f6
parenta37e5688730582ccadca6f5f139ae36d9d98fd56 (diff)
downloadorg.eclipse.cdt-dc0cd6d731b1e0b838fa2e0f234e9d9d5fb8fbdc.tar.gz
org.eclipse.cdt-dc0cd6d731b1e0b838fa2e0f234e9d9d5fb8fbdc.tar.xz
org.eclipse.cdt-dc0cd6d731b1e0b838fa2e0f234e9d9d5fb8fbdc.zip
Fix 150565.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java4
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java19
2 files changed, 19 insertions, 4 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
index 14e135519e..df0f2fa8cc 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
@@ -249,8 +249,8 @@ public class ExpressionManager extends Manager {
} catch (MIException e) {
//throw new MI2CDIException(e);
}
- //List varList = getVariableList(target);
- //varList.remove(variable);
+ List varList = getVariableList(target);
+ varList.remove(variable);
// remove any children
ICDIVariable[] children = variable.children;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java
index e8eab22252..8a0df26e4b 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Expression.java
@@ -30,6 +30,8 @@ public class Expression extends CObject implements ICDIExpression {
private int id;
String fExpression;
Type fType;
+ Variable fVariable;
+ ICDIStackFrame fContext;
public Expression(Target target, String ex) {
super(target);
@@ -96,8 +98,19 @@ public class Expression extends CObject implements ICDIExpression {
public ICDIValue getValue(ICDIStackFrame context) throws CDIException {
Session session = (Session)getTarget().getSession();
ExpressionManager mgr = session.getExpressionManager();
- Variable var = mgr.createVariable((StackFrame)context, getExpressionText());
- return var.getValue();
+ if (fVariable != null && fContext != null && !context.equals(fContext))
+ { // Get rid of the underlying variable if the context has changed.
+ // This is defensive, in practice each stack frame has it's own
+ // list of expressions.
+ mgr.deleteVariable(fVariable);
+ fVariable = null;
+ }
+ if (fVariable == null)
+ { // Reuse the variable so we don't have to ask gdb to create another one. Bug 150565.
+ fVariable = mgr.createVariable((StackFrame)context, getExpressionText());
+ }
+ fContext = context;
+ return fVariable.getValue();
}
/* (non-Javadoc)
@@ -107,6 +120,8 @@ public class Expression extends CObject implements ICDIExpression {
Session session = (Session)getTarget().getSession();
ExpressionManager mgr = session.getExpressionManager();
mgr.destroyExpressions((Target)getTarget(), new Expression[] {this});
+ if (fVariable != null)
+ mgr.deleteVariable(fVariable);
}
}

Back to the top