mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2005-08-28 Alain Magloire
Speed improvement after exchanging with the HP folks. HP has apps having hundred of local variable running on machine with hundred of registers. The latency of the command "-var-create" is too taxing. So we take the approach of not waiting for post command MISession.postCommand(MIVarCreate, -1) and synchronize when we need the mi varObj. The next step will be to cache the types, since sending ptype/whatis is also time consuming. * cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java * mi/org/eclipse/cdt/debug/mi/core/RxThread.java
This commit is contained in:
parent
41d098da72
commit
55872940c2
11 changed files with 190 additions and 96 deletions
|
@ -1,3 +1,25 @@
|
|||
2005-08-28 Alain Magloire
|
||||
Speed improvement after exchanging with the HP folks.
|
||||
HP has apps having hundred of local variable running on machine
|
||||
with hundred of registers. The latency of the command "-var-create"
|
||||
is too taxing. So we take the approach of not waiting for post command
|
||||
MISession.postCommand(MIVarCreate, -1) and synchronize when we need the
|
||||
mi varObj.
|
||||
|
||||
The next step will be to cache the types, since sending ptype/whatis
|
||||
is also time consuming.
|
||||
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Argument.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/GlobalVariable.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocalVariable.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/ThreadStorage.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
|
||||
* mi/org/eclipse/cdt/debug/mi/core/RxThread.java
|
||||
|
||||
2005-08-26 Mikhail Khodjaiants
|
||||
Bug 108130: wrong type shown on breakpoint view for R watchpoint created from gdb console.
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
|
||||
|
|
|
@ -165,12 +165,16 @@ public class ExpressionManager extends Manager {
|
|||
List varList = getVariableList(target);
|
||||
Variable[] vars = (Variable[])varList.toArray(new Variable[0]);
|
||||
for (int i = 0; i < vars.length; i++) {
|
||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||
return vars[i];
|
||||
}
|
||||
Variable v = vars[i].getChild(varName);
|
||||
if (v != null) {
|
||||
return v;
|
||||
try {
|
||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||
return vars[i];
|
||||
}
|
||||
Variable v = vars[i].getChild(varName);
|
||||
if (v != null) {
|
||||
return v;
|
||||
}
|
||||
} catch (CDIException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -107,19 +107,15 @@ public class RegisterManager extends Manager {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#getMIVar()
|
||||
*/
|
||||
public MIVar getMIVar() {
|
||||
if (fMiVar == null) {
|
||||
try {
|
||||
fMiVar = createMiVar((StackFrame)getStackFrame(), getName());
|
||||
} catch (CDIException e) {
|
||||
//
|
||||
}
|
||||
public MIVar getMIVar() throws CDIException {
|
||||
if (fMIVar == null) {
|
||||
fMIVar = createMiVar((StackFrame)getStackFrame(), getName());
|
||||
}
|
||||
return fMiVar;
|
||||
return fMIVar;
|
||||
}
|
||||
|
||||
public void setMIVar(MIVar newMIVar) {
|
||||
fMiVar = newMIVar;
|
||||
fMIVar = newMIVar;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,12 +192,14 @@ public class RegisterManager extends Manager {
|
|||
MISession mi = target.getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIVarCreate var = factory.createMIVarCreate(name);
|
||||
mi.postCommand(var);
|
||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
reg = new Register(regDesc, info.getMIVar());
|
||||
mi.postCommand(var, -1);
|
||||
// mi.postCommand(var);
|
||||
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
// if (info == null) {
|
||||
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
// }
|
||||
// reg = new Register(regDesc, info.getMIVar());
|
||||
reg = new Register(regDesc, var);
|
||||
List regList = getRegistersList(target);
|
||||
regList.add(reg);
|
||||
} catch (MIException e) {
|
||||
|
@ -280,15 +278,20 @@ public class RegisterManager extends Manager {
|
|||
Target target = ((Session)getSession()).getTarget(miSession);
|
||||
Register[] regs = getRegisters(target);
|
||||
for (int i = 0; i < regs.length; i++) {
|
||||
if (regs[i].getMIVar().getVarName().equals(varName)) {
|
||||
return regs[i];
|
||||
}
|
||||
try {
|
||||
Register r = (Register)regs[i].getChild(varName);
|
||||
if (r != null) {
|
||||
return r;
|
||||
if (regs[i].getMIVar().getVarName().equals(varName)) {
|
||||
return regs[i];
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
try {
|
||||
Register r = (Register)regs[i].getChild(varName);
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
// ignore ???
|
||||
}
|
||||
} catch (CDIException e1) {
|
||||
// ignore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -372,13 +375,13 @@ public class RegisterManager extends Manager {
|
|||
return new Register[0];
|
||||
}
|
||||
|
||||
private Variable[] getVariables(Target target) {
|
||||
List varList = (List)varsMap.get(target);
|
||||
if (varList != null) {
|
||||
return (Variable[]) varList.toArray(new Variable[varList.size()]);
|
||||
}
|
||||
return new Register[0];
|
||||
}
|
||||
// private Variable[] getVariables(Target target) {
|
||||
// List varList = (List)varsMap.get(target);
|
||||
// if (varList != null) {
|
||||
// return (Variable[]) varList.toArray(new Variable[varList.size()]);
|
||||
// }
|
||||
// return new Register[0];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the Element with this thread/stackframe, and with this name.
|
||||
|
|
|
@ -59,7 +59,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
|
|||
import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
|
||||
|
||||
/**
|
||||
|
@ -96,6 +95,7 @@ public class VariableManager extends Manager {
|
|||
Target target = ((Session)getSession()).getTarget(miSession);
|
||||
return getVariable(target, varName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the element that have the uniq varName.
|
||||
* null is return if the element is not in the cache.
|
||||
|
@ -103,12 +103,16 @@ public class VariableManager extends Manager {
|
|||
public Variable getVariable(Target target, String varName) {
|
||||
Variable[] vars = getVariables(target);
|
||||
for (int i = 0; i < vars.length; i++) {
|
||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||
return vars[i];
|
||||
}
|
||||
Variable v = vars[i].getChild(varName);
|
||||
if (v != null) {
|
||||
return v;
|
||||
try {
|
||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||
return vars[i];
|
||||
}
|
||||
Variable v = vars[i].getChild(varName);
|
||||
if (v != null) {
|
||||
return v;
|
||||
}
|
||||
} catch (CDIException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -224,9 +228,13 @@ public class VariableManager extends Manager {
|
|||
synchronized (varList) {
|
||||
for (Iterator iterator = varList.iterator(); iterator.hasNext();) {
|
||||
Variable variable = (Variable)iterator.next();
|
||||
if (variable.getMIVar().getVarName().equals(varName)) {
|
||||
iterator.remove();
|
||||
return variable;
|
||||
try {
|
||||
if (variable.getMIVar().getVarName().equals(varName)) {
|
||||
iterator.remove();
|
||||
return variable;
|
||||
}
|
||||
} catch (CDIException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -365,12 +373,14 @@ public class VariableManager extends Manager {
|
|||
MISession mi = target.getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIVarCreate var = factory.createMIVarCreate(name);
|
||||
mi.postCommand(var);
|
||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
argument = new Argument(argDesc, info.getMIVar());
|
||||
mi.postCommand(var, -1);
|
||||
argument = new Argument(argDesc, var);
|
||||
// mi.postCommand(var);
|
||||
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
// if (info == null) {
|
||||
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
// }
|
||||
// argument = new Argument(argDesc, info.getMIVar());
|
||||
List variablesList = getVariablesList(target);
|
||||
variablesList.add(argument);
|
||||
} catch (MIException e) {
|
||||
|
@ -457,12 +467,14 @@ public class VariableManager extends Manager {
|
|||
MISession mi = target.getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIVarCreate var = factory.createMIVarCreate(name);
|
||||
mi.postCommand(var);
|
||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
global = new GlobalVariable(varDesc, info.getMIVar());
|
||||
mi.postCommand(var, -1);
|
||||
global = new GlobalVariable(varDesc, var);
|
||||
// mi.postCommand(var;
|
||||
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
// if (info == null) {
|
||||
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
// }
|
||||
// global = new GlobalVariable(varDesc, info.getMIVar());
|
||||
List variablesList = getVariablesList(target);
|
||||
variablesList.add(global);
|
||||
} catch (MIException e) {
|
||||
|
@ -524,12 +536,14 @@ public class VariableManager extends Manager {
|
|||
MISession mi = target.getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIVarCreate var = factory.createMIVarCreate(name);
|
||||
mi.postCommand(var);
|
||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
local = new LocalVariable(varDesc, info.getMIVar());
|
||||
mi.postCommand(var, -1);
|
||||
local = new LocalVariable(varDesc, var);
|
||||
// mi.postCommand(var);
|
||||
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||
// if (info == null) {
|
||||
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
// }
|
||||
// local = new LocalVariable(varDesc, info.getMIVar());
|
||||
List variablesList = getVariablesList(target);
|
||||
variablesList.add(local);
|
||||
} catch (MIException e) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +23,7 @@ public class Argument extends Variable implements ICDIArgument {
|
|||
super(target, thread, frame, n, q, pos, depth, v);
|
||||
}
|
||||
|
||||
public Argument(ArgumentDescriptor obj, MIVar var) {
|
||||
public Argument(ArgumentDescriptor obj, MIVarCreate var) {
|
||||
super(obj, var);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
||||
/**
|
||||
|
@ -24,7 +25,7 @@ public class GlobalVariable extends Variable implements ICDIGlobalVariable {
|
|||
* @param obj
|
||||
* @param v
|
||||
*/
|
||||
public GlobalVariable(VariableDescriptor obj, MIVar v) {
|
||||
public GlobalVariable(VariableDescriptor obj, MIVarCreate v) {
|
||||
super(obj, v);
|
||||
}
|
||||
|
||||
|
@ -38,8 +39,8 @@ public class GlobalVariable extends Variable implements ICDIGlobalVariable {
|
|||
* @param depth
|
||||
* @param v
|
||||
*/
|
||||
public GlobalVariable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar v) {
|
||||
super(target, thread, frame, n, q, pos, depth, v);
|
||||
public GlobalVariable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar miVar) {
|
||||
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariable;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
||||
/**
|
||||
|
@ -23,15 +24,13 @@ public class LocalVariable extends Variable implements ICDILocalVariable {
|
|||
* @param obj
|
||||
* @param v
|
||||
*/
|
||||
public LocalVariable(LocalVariableDescriptor obj, MIVar v) {
|
||||
public LocalVariable(LocalVariableDescriptor obj, MIVarCreate v) {
|
||||
super(obj, v);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public LocalVariable(Target target, Thread thread, StackFrame frame, String n, String q,
|
||||
int pos, int depth, MIVar v) {
|
||||
super(target, thread, frame, n, q, pos, depth, v);
|
||||
int pos, int depth, MIVar miVar) {
|
||||
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
||||
/**
|
||||
|
@ -35,11 +36,11 @@ public class Register extends Variable implements ICDIRegister {
|
|||
* @param v
|
||||
*/
|
||||
public Register(Target target, Thread thread, StackFrame frame,
|
||||
String n, String q, int pos, int depth, MIVar v) {
|
||||
super(target, thread, frame, n, q, pos, depth, v);
|
||||
String n, String q, int pos, int depth, MIVar miVar) {
|
||||
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||
}
|
||||
|
||||
public Register(RegisterDescriptor obj, MIVar var) {
|
||||
public Register(RegisterDescriptor obj, MIVarCreate var) {
|
||||
super(obj, var);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorage;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +24,7 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
|||
* @param obj
|
||||
* @param v
|
||||
*/
|
||||
public ThreadStorage(VariableDescriptor obj, MIVar v) {
|
||||
public ThreadStorage(VariableDescriptor obj, MIVarCreate v) {
|
||||
super(obj, v);
|
||||
}
|
||||
|
||||
|
@ -38,8 +39,8 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
|||
* @param v
|
||||
*/
|
||||
public ThreadStorage(Target target, Thread thread, StackFrame frame,
|
||||
String n, String q, int pos, int depth, MIVar v) {
|
||||
super(target, thread, frame, n, q, pos, depth, v);
|
||||
String n, String q, int pos, int depth, MIVar miVar) {
|
||||
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -48,7 +49,7 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
|||
protected Variable createVariable(Target target, Thread thread,
|
||||
StackFrame frame, String name, String fullName, int pos, int depth,
|
||||
MIVar miVar) {
|
||||
return null;
|
||||
return new Register(target, thread, frame, name, fullName, pos, depth, miVar);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType;
|
||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||
import org.eclipse.cdt.debug.mi.core.MIPlugin;
|
||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager;
|
||||
|
@ -56,6 +57,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.type.StructValue;
|
|||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharValue;
|
||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarAssign;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoExpression;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoType;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
|
||||
|
@ -64,6 +66,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIVarShowAttributes;
|
|||
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoExpressionInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVarListChildrenInfo;
|
||||
|
@ -73,7 +76,8 @@ import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo;
|
|||
*/
|
||||
public abstract class Variable extends VariableDescriptor implements ICDIVariable {
|
||||
|
||||
protected MIVar fMiVar;
|
||||
protected MIVarCreate fVarCreateCMD;
|
||||
protected MIVar fMIVar;
|
||||
Value value;
|
||||
public ICDIVariable[] children = new ICDIVariable[0];
|
||||
String editable = null;
|
||||
|
@ -81,14 +85,14 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
boolean isFake = false;
|
||||
boolean isUpdated = true;
|
||||
|
||||
public Variable(VariableDescriptor obj, MIVar v) {
|
||||
public Variable(VariableDescriptor obj, MIVarCreate var) {
|
||||
super(obj);
|
||||
fMiVar = v;
|
||||
fVarCreateCMD = var;
|
||||
}
|
||||
|
||||
public Variable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar v) {
|
||||
public Variable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar miVar) {
|
||||
super(target, thread, frame, n, q, pos, depth);
|
||||
fMiVar = v;
|
||||
fMIVar = miVar;
|
||||
}
|
||||
|
||||
public void setUpdated(boolean update) {
|
||||
|
@ -105,20 +109,58 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
mgr.update(this);
|
||||
}
|
||||
|
||||
public MIVar getMIVar() {
|
||||
return fMiVar;
|
||||
public MIVar getMIVar() throws CDIException {
|
||||
if (fMIVar == null) {
|
||||
|
||||
// Oops! what's up here, we should use Assert
|
||||
if (fVarCreateCMD == null) {
|
||||
throw new CDIException("Incomplete initialization of variable"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
try {
|
||||
MISession mi = ((Target)getTarget()).getMISession();
|
||||
MIVarCreateInfo info = null;
|
||||
// Wait for the response or timedout
|
||||
synchronized (fVarCreateCMD) {
|
||||
// RxThread will set the MIOutput on the cmd
|
||||
// when the response arrive.
|
||||
while ((info = fVarCreateCMD.getMIVarCreateInfo()) == null) {
|
||||
try {
|
||||
fVarCreateCMD.wait(mi.getCommandTimeout());
|
||||
info = fVarCreateCMD.getMIVarCreateInfo();
|
||||
if (info == null) {
|
||||
throw new MIException(MIPlugin.getResourceString("src.MISession.Target_not_responding")); //$NON-NLS-1$
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
}
|
||||
fMIVar = info.getMIVar();
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
}
|
||||
}
|
||||
return fMIVar;
|
||||
}
|
||||
|
||||
public Variable getChild(String name) {
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
Variable variable = (Variable) children[i];
|
||||
if (name.equals(variable.getMIVar().getVarName())) {
|
||||
return variable;
|
||||
}
|
||||
// Look also in the grandchildren.
|
||||
Variable grandChild = variable.getChild(name);
|
||||
if (grandChild != null) {
|
||||
return grandChild;
|
||||
try {
|
||||
if (name.equals(variable.getMIVar().getVarName())) {
|
||||
return variable;
|
||||
}
|
||||
// Look also in the grandchildren.
|
||||
Variable grandChild = variable.getChild(name);
|
||||
if (grandChild != null) {
|
||||
return grandChild;
|
||||
}
|
||||
} catch (CDIException e) {
|
||||
// ignore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -432,7 +474,12 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
* @return
|
||||
*/
|
||||
public boolean equals(Variable variable) {
|
||||
return getMIVar().getVarName().equals(variable.getMIVar().getVarName());
|
||||
try {
|
||||
return getMIVar().getVarName().equals(variable.getMIVar().getVarName());
|
||||
} catch (CDIException e) {
|
||||
// ignore.
|
||||
}
|
||||
return super.equals(variable);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -220,6 +220,9 @@ public class RxThread extends Thread {
|
|||
processMIOOBRecord(rr, list);
|
||||
}
|
||||
|
||||
// Set the accumulate console Stream
|
||||
response.setMIOOBRecords(oobRecords);
|
||||
|
||||
// Notify the waiting command.
|
||||
// Notify any command waiting for a ResultRecord.
|
||||
if (cmd != null) {
|
||||
|
@ -231,8 +234,6 @@ public class RxThread extends Thread {
|
|||
}
|
||||
|
||||
synchronized (cmd) {
|
||||
// Set the accumulate console Stream
|
||||
response.setMIOOBRecords(oobRecords);
|
||||
cmd.setMIOutput(response);
|
||||
cmd.notifyAll();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue