1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

2005-07-26 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
This commit is contained in:
Alain Magloire 2005-07-26 19:57:10 +00:00
parent 6ca469c8d4
commit c0b5b6e08c
4 changed files with 67 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2005-07-26 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-21 Alain Magloire
Fix for PR 103193
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java

View file

@ -626,6 +626,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()) {
@ -635,12 +636,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

View file

@ -47,6 +47,11 @@ public class Value extends CObject implements ICDIValue {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getValueString()
*/
public String getValueString() throws CDIException {
// make sure the variable is updated.
if (! variable.isUpdated()) {
variable.update();
}
String result = ""; //$NON-NLS-1$
MISession mi = ((Target)getTarget()).getMISession();
CommandFactory factory = mi.getCommandFactory();

View file

@ -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;
}