mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +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:
parent
6ca469c8d4
commit
c0b5b6e08c
4 changed files with 67 additions and 0 deletions
|
@ -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
|
2005-07-21 Alain Magloire
|
||||||
Fix for PR 103193
|
Fix for PR 103193
|
||||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java
|
||||||
|
|
|
@ -626,6 +626,7 @@ public class VariableManager extends Manager {
|
||||||
//throw new MI2CDIException(e);
|
//throw new MI2CDIException(e);
|
||||||
eventList.add(new MIVarDeletedEvent(mi, varName));
|
eventList.add(new MIVarDeletedEvent(mi, varName));
|
||||||
}
|
}
|
||||||
|
variable.setUpdated(true);
|
||||||
for (int j = 0; j < changes.length; j++) {
|
for (int j = 0; j < changes.length; j++) {
|
||||||
String n = changes[j].getVarName();
|
String n = changes[j].getVarName();
|
||||||
if (changes[j].isInScope()) {
|
if (changes[j].isInScope()) {
|
||||||
|
@ -635,12 +636,52 @@ public class VariableManager extends Manager {
|
||||||
eventList.add(new MIVarDeletedEvent(mi, n));
|
eventList.add(new MIVarDeletedEvent(mi, n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
variable.setUpdated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]);
|
MIEvent[] events = (MIEvent[]) eventList.toArray(new MIEvent[0]);
|
||||||
mi.fireEvents(events);
|
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
|
* 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
|
* have a very deep stack and lots of local variables. We can assume here that the local variables
|
||||||
|
|
|
@ -47,6 +47,11 @@ public class Value extends CObject implements ICDIValue {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getValueString()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getValueString()
|
||||||
*/
|
*/
|
||||||
public String getValueString() throws CDIException {
|
public String getValueString() throws CDIException {
|
||||||
|
// make sure the variable is updated.
|
||||||
|
if (! variable.isUpdated()) {
|
||||||
|
variable.update();
|
||||||
|
}
|
||||||
|
|
||||||
String result = ""; //$NON-NLS-1$
|
String result = ""; //$NON-NLS-1$
|
||||||
MISession mi = ((Target)getTarget()).getMISession();
|
MISession mi = ((Target)getTarget()).getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
|
|
@ -79,6 +79,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
String editable = null;
|
String editable = null;
|
||||||
String language;
|
String language;
|
||||||
boolean isFake = false;
|
boolean isFake = false;
|
||||||
|
boolean isUpdated = true;
|
||||||
|
|
||||||
public Variable(VariableDescriptor obj, MIVar v) {
|
public Variable(VariableDescriptor obj, MIVar v) {
|
||||||
super(obj);
|
super(obj);
|
||||||
|
@ -90,6 +91,20 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
fMiVar = v;
|
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() {
|
public MIVar getMIVar() {
|
||||||
return fMiVar;
|
return fMiVar;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue