Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorAlain Magloire2007-01-16 16:57:44 +0000
committerAlain Magloire2007-01-16 16:57:44 +0000
commit7bf5aee354fd060fa9eac207d034f1809e2c6e6a (patch)
tree7b84111d4839362d2cb95043b6e108212a443d2e /debug
parent8d9f8b03aaebc45028f45a66ee8adf7bbec3e25c (diff)
downloadorg.eclipse.cdt-7bf5aee354fd060fa9eac207d034f1809e2c6e6a.tar.gz
org.eclipse.cdt-7bf5aee354fd060fa9eac207d034f1809e2c6e6a.tar.xz
org.eclipse.cdt-7bf5aee354fd060fa9eac207d034f1809e2c6e6a.zip
Fix for PR169548, where the MI variable was not actually created. At the update we try to create again
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java62
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java4
2 files changed, 32 insertions, 34 deletions
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 9bff31b2a62..9d87b53f416 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
@@ -636,30 +636,7 @@ public class VariableManager extends Manager {
for (int i = 0; i < vars.length; i++) {
Variable variable = vars[i];
if (isVariableNeedsToBeUpdate(variable, currentStack, frames, lowLevel)) {
- 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));
- }
- }
+ update(target, variable, eventList);
} else {
variable.setUpdated(false);
}
@@ -680,19 +657,36 @@ public class VariableManager extends Manager {
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$
+ String miVarName = variable.getMIVar().getVarName();
+ MIVarUpdate update = factory.createMIVarUpdate(miVarName);
+ 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, miVarName));
+ }
+ } catch (CDIException exc) {
+ // When the variable was out of scope the fisrt time, the getMIVar() generates an exception.
+ // Then create again the variable, set the fVarCreateCMD of Variable class and try again the update command.
+ try {
+ MIVarCreate var = factory.createMIVarCreate(variable.getName());
+ mi.postCommand(var, -1);
+ variable.setMIVarCreate(var);
+ try {
+ update(target,variable,eventList);
+ } catch (Exception ex1) {
+ //nothing...
+ }
+ } catch (MIException e) {
+ throw new MI2CDIException(e);
}
- 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++) {
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 19122ec5630..3fc0b267bff 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
@@ -522,4 +522,8 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
}
return fTypename;
}
+
+ public void setMIVarCreate(MIVarCreate miVar) {
+ fVarCreateCMD = miVar;
+ }
}

Back to the top