mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 21:35:40 +02:00
Fix for PR169548, where the MI variable was not actually created. At the update we try to create again
This commit is contained in:
parent
8d9f8b03aa
commit
7bf5aee354
2 changed files with 32 additions and 34 deletions
|
@ -636,30 +636,7 @@ public class VariableManager extends Manager {
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
Variable variable = vars[i];
|
Variable variable = vars[i];
|
||||||
if (isVariableNeedsToBeUpdate(variable, currentStack, frames, lowLevel)) {
|
if (isVariableNeedsToBeUpdate(variable, currentStack, frames, lowLevel)) {
|
||||||
String varName = variable.getMIVar().getVarName();
|
update(target, variable, eventList);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
variable.setUpdated(false);
|
variable.setUpdated(false);
|
||||||
}
|
}
|
||||||
|
@ -680,19 +657,36 @@ public class VariableManager extends Manager {
|
||||||
public void update(Target target, Variable variable, List eventList) throws CDIException {
|
public void update(Target target, Variable variable, List eventList) throws CDIException {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
String varName = variable.getMIVar().getVarName();
|
|
||||||
MIVarChange[] changes = noChanges;
|
MIVarChange[] changes = noChanges;
|
||||||
MIVarUpdate update = factory.createMIVarUpdate(varName);
|
|
||||||
try {
|
try {
|
||||||
mi.postCommand(update);
|
String miVarName = variable.getMIVar().getVarName();
|
||||||
MIVarUpdateInfo info = update.getMIVarUpdateInfo();
|
MIVarUpdate update = factory.createMIVarUpdate(miVarName);
|
||||||
if (info == null) {
|
try {
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
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);
|
variable.setUpdated(true);
|
||||||
for (int j = 0; j < changes.length; j++) {
|
for (int j = 0; j < changes.length; j++) {
|
||||||
|
|
|
@ -522,4 +522,8 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
}
|
}
|
||||||
return fTypename;
|
return fTypename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMIVarCreate(MIVarCreate miVar) {
|
||||||
|
fVarCreateCMD = miVar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue