Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2005-08-04 23:22:49 +0000
committerAlain Magloire2005-08-04 23:22:49 +0000
commitb262880f9cffbeb6c1bc558146045aa071a3eeb6 (patch)
tree825ebb89501ea8e2530cb9f5043cae9ed1e7d95c
parent8adb497f927fdc24a2071ceec4cf08b3f2bde839 (diff)
downloadorg.eclipse.cdt-b262880f9cffbeb6c1bc558146045aa071a3eeb6.tar.gz
org.eclipse.cdt-b262880f9cffbeb6c1bc558146045aa071a3eeb6.tar.xz
org.eclipse.cdt-b262880f9cffbeb6c1bc558146045aa071a3eeb6.zip
2005-08-04 Alain Magloire
Fix for 92446 * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/ChangeLog6
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java41
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java7
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java15
4 files changed, 68 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
index ff6ca5bf57e..a070e3d1769 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-04 Alain Magloire
+ Fix for 92446
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
+
2005-07-26 Mikhail Khodjaiants
Bug 105234: Wrong watchpoint type.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
index 8d3349a391a..13bbb3765ba 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
@@ -620,6 +620,7 @@ public class VariableManager extends Manager {
//throw new MI2CDIException(e);
eventList.add(new MIVarDeletedEvent(mi, varName));
}
+ variable.setUpdated(true);
for (int j = 0; j < changes.length; j++) {
String n = changes[j].getVarName();
if (changes[j].isInScope()) {
@@ -629,12 +630,52 @@ public class VariableManager extends Manager {
eventList.add(new MIVarDeletedEvent(mi, n));
}
}
+ } else {
+ variable.setUpdated(false);
}
}
MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]);
mi.fireEvents(events);
}
+ public void update(Variable variable) throws CDIException {
+ Target target = (Target)variable.getTarget();
+ MISession mi = target.getMISession();
+ List eventList = new ArrayList();
+ update(target, variable, eventList);
+ MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]);
+ mi.fireEvents(events);
+ }
+
+ public void update(Target target, Variable variable, List eventList) throws CDIException {
+ MISession mi = target.getMISession();
+ CommandFactory factory = mi.getCommandFactory();
+ String varName = variable.getMIVar().getVarName();
+ MIVarChange[] changes = noChanges;
+ MIVarUpdate update = factory.createMIVarUpdate(varName);
+ try {
+ mi.postCommand(update);
+ MIVarUpdateInfo info = update.getMIVarUpdateInfo();
+ if (info == null) {
+ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
+ }
+ changes = info.getMIVarChanges();
+ } catch (MIException e) {
+ //throw new MI2CDIException(e);
+ eventList.add(new MIVarDeletedEvent(mi, varName));
+ }
+ variable.setUpdated(true);
+ for (int j = 0; j < changes.length; j++) {
+ String n = changes[j].getVarName();
+ if (changes[j].isInScope()) {
+ eventList.add(new MIVarChangedEvent(mi, n));
+ } else {
+ destroyVariable(variable);
+ eventList.add(new MIVarDeletedEvent(mi, n));
+ }
+ }
+ }
+
/**
* We are trying to minimize the impact of the updates, this can be very long and unncessary if we
* have a very deep stack and lots of local variables. We can assume here that the local variables
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
index fb9e9455e64..5f95e1586a7 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
@@ -47,7 +47,12 @@ public class Value extends CObject implements ICDIValue {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getValueString()
*/
public String getValueString() throws CDIException {
- String result = ""; //$NON-NLS-1$
+ // make sure the variable is updated.
+ if (! getVariable().isUpdated()) {
+ getVariable().update();
+ }
+
+ String result = ""; //$NON-NLS-1$
MISession mi = ((Target)getTarget()).getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarEvaluateExpression var =
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
index e2838a1b4eb..7dcd976fc5e 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
@@ -79,6 +79,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
String editable = null;
String language;
boolean isFake = false;
+ boolean isUpdated = true;
public Variable(VariableDescriptor obj, MIVar v) {
super(obj);
@@ -90,6 +91,20 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
fMiVar = v;
}
+ public void setUpdated(boolean update) {
+ isUpdated = update;
+ }
+
+ public boolean isUpdated() {
+ return isUpdated;
+ }
+
+ public void update() throws CDIException {
+ Session session = (Session)getTarget().getSession();
+ VariableManager mgr = session.getVariableManager();
+ mgr.update(this);
+ }
+
public MIVar getMIVar() {
return fMiVar;
}

Back to the top