mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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
|
2005-08-26 Mikhail Khodjaiants
|
||||||
Bug 108130: wrong type shown on breakpoint view for R watchpoint created from gdb console.
|
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
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
|
||||||
|
|
|
@ -165,12 +165,16 @@ public class ExpressionManager extends Manager {
|
||||||
List varList = getVariableList(target);
|
List varList = getVariableList(target);
|
||||||
Variable[] vars = (Variable[])varList.toArray(new Variable[0]);
|
Variable[] vars = (Variable[])varList.toArray(new Variable[0]);
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
try {
|
||||||
return vars[i];
|
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||||
}
|
return vars[i];
|
||||||
Variable v = vars[i].getChild(varName);
|
}
|
||||||
if (v != null) {
|
Variable v = vars[i].getChild(varName);
|
||||||
return v;
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
} catch (CDIException e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -107,19 +107,15 @@ public class RegisterManager extends Manager {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#getMIVar()
|
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#getMIVar()
|
||||||
*/
|
*/
|
||||||
public MIVar getMIVar() {
|
public MIVar getMIVar() throws CDIException {
|
||||||
if (fMiVar == null) {
|
if (fMIVar == null) {
|
||||||
try {
|
fMIVar = createMiVar((StackFrame)getStackFrame(), getName());
|
||||||
fMiVar = createMiVar((StackFrame)getStackFrame(), getName());
|
|
||||||
} catch (CDIException e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fMiVar;
|
return fMIVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMIVar(MIVar newMIVar) {
|
public void setMIVar(MIVar newMIVar) {
|
||||||
fMiVar = newMIVar;
|
fMIVar = newMIVar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,12 +192,14 @@ public class RegisterManager extends Manager {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
mi.postCommand(var);
|
mi.postCommand(var, -1);
|
||||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
// mi.postCommand(var);
|
||||||
if (info == null) {
|
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
// 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, info.getMIVar());
|
||||||
|
reg = new Register(regDesc, var);
|
||||||
List regList = getRegistersList(target);
|
List regList = getRegistersList(target);
|
||||||
regList.add(reg);
|
regList.add(reg);
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -280,15 +278,20 @@ public class RegisterManager extends Manager {
|
||||||
Target target = ((Session)getSession()).getTarget(miSession);
|
Target target = ((Session)getSession()).getTarget(miSession);
|
||||||
Register[] regs = getRegisters(target);
|
Register[] regs = getRegisters(target);
|
||||||
for (int i = 0; i < regs.length; i++) {
|
for (int i = 0; i < regs.length; i++) {
|
||||||
if (regs[i].getMIVar().getVarName().equals(varName)) {
|
|
||||||
return regs[i];
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Register r = (Register)regs[i].getChild(varName);
|
if (regs[i].getMIVar().getVarName().equals(varName)) {
|
||||||
if (r != null) {
|
return regs[i];
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
} 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;
|
return null;
|
||||||
|
@ -372,13 +375,13 @@ public class RegisterManager extends Manager {
|
||||||
return new Register[0];
|
return new Register[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private Variable[] getVariables(Target target) {
|
// private Variable[] getVariables(Target target) {
|
||||||
List varList = (List)varsMap.get(target);
|
// List varList = (List)varsMap.get(target);
|
||||||
if (varList != null) {
|
// if (varList != null) {
|
||||||
return (Variable[]) varList.toArray(new Variable[varList.size()]);
|
// return (Variable[]) varList.toArray(new Variable[varList.size()]);
|
||||||
}
|
// }
|
||||||
return new Register[0];
|
// return new Register[0];
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Element with this thread/stackframe, and with this name.
|
* 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.MIStackListLocalsInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
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.MIVarChange;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,6 +95,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = ((Session)getSession()).getTarget(miSession);
|
Target target = ((Session)getSession()).getTarget(miSession);
|
||||||
return getVariable(target, varName);
|
return getVariable(target, varName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the element that have the uniq varName.
|
* Return the element that have the uniq varName.
|
||||||
* null is return if the element is not in the cache.
|
* 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) {
|
public Variable getVariable(Target target, String varName) {
|
||||||
Variable[] vars = getVariables(target);
|
Variable[] vars = getVariables(target);
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
try {
|
||||||
return vars[i];
|
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||||
}
|
return vars[i];
|
||||||
Variable v = vars[i].getChild(varName);
|
}
|
||||||
if (v != null) {
|
Variable v = vars[i].getChild(varName);
|
||||||
return v;
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
} catch (CDIException e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -224,9 +228,13 @@ public class VariableManager extends Manager {
|
||||||
synchronized (varList) {
|
synchronized (varList) {
|
||||||
for (Iterator iterator = varList.iterator(); iterator.hasNext();) {
|
for (Iterator iterator = varList.iterator(); iterator.hasNext();) {
|
||||||
Variable variable = (Variable)iterator.next();
|
Variable variable = (Variable)iterator.next();
|
||||||
if (variable.getMIVar().getVarName().equals(varName)) {
|
try {
|
||||||
iterator.remove();
|
if (variable.getMIVar().getVarName().equals(varName)) {
|
||||||
return variable;
|
iterator.remove();
|
||||||
|
return variable;
|
||||||
|
}
|
||||||
|
} catch (CDIException e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,12 +373,14 @@ public class VariableManager extends Manager {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
mi.postCommand(var);
|
mi.postCommand(var, -1);
|
||||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
argument = new Argument(argDesc, var);
|
||||||
if (info == null) {
|
// mi.postCommand(var);
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
}
|
// if (info == null) {
|
||||||
argument = new Argument(argDesc, info.getMIVar());
|
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
// }
|
||||||
|
// argument = new Argument(argDesc, info.getMIVar());
|
||||||
List variablesList = getVariablesList(target);
|
List variablesList = getVariablesList(target);
|
||||||
variablesList.add(argument);
|
variablesList.add(argument);
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -457,12 +467,14 @@ public class VariableManager extends Manager {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
mi.postCommand(var);
|
mi.postCommand(var, -1);
|
||||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
global = new GlobalVariable(varDesc, var);
|
||||||
if (info == null) {
|
// mi.postCommand(var;
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
}
|
// if (info == null) {
|
||||||
global = new GlobalVariable(varDesc, info.getMIVar());
|
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
// }
|
||||||
|
// global = new GlobalVariable(varDesc, info.getMIVar());
|
||||||
List variablesList = getVariablesList(target);
|
List variablesList = getVariablesList(target);
|
||||||
variablesList.add(global);
|
variablesList.add(global);
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -524,12 +536,14 @@ public class VariableManager extends Manager {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
mi.postCommand(var);
|
mi.postCommand(var, -1);
|
||||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
local = new LocalVariable(varDesc, var);
|
||||||
if (info == null) {
|
// mi.postCommand(var);
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
// MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
}
|
// if (info == null) {
|
||||||
local = new LocalVariable(varDesc, info.getMIVar());
|
// throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
// }
|
||||||
|
// local = new LocalVariable(varDesc, info.getMIVar());
|
||||||
List variablesList = getVariablesList(target);
|
List variablesList = getVariablesList(target);
|
||||||
variablesList.add(local);
|
variablesList.add(local);
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
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;
|
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);
|
super(target, thread, frame, n, q, pos, depth, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Argument(ArgumentDescriptor obj, MIVar var) {
|
public Argument(ArgumentDescriptor obj, MIVarCreate var) {
|
||||||
super(obj, var);
|
super(obj, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable;
|
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;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +25,7 @@ public class GlobalVariable extends Variable implements ICDIGlobalVariable {
|
||||||
* @param obj
|
* @param obj
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public GlobalVariable(VariableDescriptor obj, MIVar v) {
|
public GlobalVariable(VariableDescriptor obj, MIVarCreate v) {
|
||||||
super(obj, v);
|
super(obj, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ public class GlobalVariable extends Variable implements ICDIGlobalVariable {
|
||||||
* @param depth
|
* @param depth
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public GlobalVariable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar 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, v);
|
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariable;
|
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;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,15 +24,13 @@ public class LocalVariable extends Variable implements ICDILocalVariable {
|
||||||
* @param obj
|
* @param obj
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public LocalVariable(LocalVariableDescriptor obj, MIVar v) {
|
public LocalVariable(LocalVariableDescriptor obj, MIVarCreate v) {
|
||||||
super(obj, v);
|
super(obj, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public LocalVariable(Target target, Thread thread, StackFrame frame, String n, String q,
|
public LocalVariable(Target target, Thread thread, StackFrame frame, String n, String q,
|
||||||
int pos, int depth, MIVar v) {
|
int pos, int depth, MIVar miVar) {
|
||||||
super(target, thread, frame, n, q, pos, depth, v);
|
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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.core.cdi.model.ICDIValue;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
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.cdi.Session;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,11 +36,11 @@ public class Register extends Variable implements ICDIRegister {
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public Register(Target target, Thread thread, StackFrame frame,
|
public Register(Target target, Thread thread, StackFrame frame,
|
||||||
String n, String q, int pos, int depth, MIVar v) {
|
String n, String q, int pos, int depth, MIVar miVar) {
|
||||||
super(target, thread, frame, n, q, pos, depth, v);
|
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Register(RegisterDescriptor obj, MIVar var) {
|
public Register(RegisterDescriptor obj, MIVarCreate var) {
|
||||||
super(obj, var);
|
super(obj, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorage;
|
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;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +24,7 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
||||||
* @param obj
|
* @param obj
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public ThreadStorage(VariableDescriptor obj, MIVar v) {
|
public ThreadStorage(VariableDescriptor obj, MIVarCreate v) {
|
||||||
super(obj, v);
|
super(obj, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
public ThreadStorage(Target target, Thread thread, StackFrame frame,
|
public ThreadStorage(Target target, Thread thread, StackFrame frame,
|
||||||
String n, String q, int pos, int depth, MIVar v) {
|
String n, String q, int pos, int depth, MIVar miVar) {
|
||||||
super(target, thread, frame, n, q, pos, depth, v);
|
super(target, thread, frame, n, q, pos, depth, miVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -48,7 +49,7 @@ public class ThreadStorage extends Variable implements ICDIThreadStorage {
|
||||||
protected Variable createVariable(Target target, Thread thread,
|
protected Variable createVariable(Target target, Thread thread,
|
||||||
StackFrame frame, String name, String fullName, int pos, int depth,
|
StackFrame frame, String name, String fullName, int pos, int depth,
|
||||||
MIVar miVar) {
|
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.ICDIType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType;
|
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.MIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.MIPlugin;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
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.CdiResources;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager;
|
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.cdi.model.type.WCharValue;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
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.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.MIVarInfoExpression;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoType;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoType;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
|
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.event.MIVarChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
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.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.MIVarInfoExpressionInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarListChildrenInfo;
|
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 {
|
public abstract class Variable extends VariableDescriptor implements ICDIVariable {
|
||||||
|
|
||||||
protected MIVar fMiVar;
|
protected MIVarCreate fVarCreateCMD;
|
||||||
|
protected MIVar fMIVar;
|
||||||
Value value;
|
Value value;
|
||||||
public ICDIVariable[] children = new ICDIVariable[0];
|
public ICDIVariable[] children = new ICDIVariable[0];
|
||||||
String editable = null;
|
String editable = null;
|
||||||
|
@ -81,14 +85,14 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
boolean isFake = false;
|
boolean isFake = false;
|
||||||
boolean isUpdated = true;
|
boolean isUpdated = true;
|
||||||
|
|
||||||
public Variable(VariableDescriptor obj, MIVar v) {
|
public Variable(VariableDescriptor obj, MIVarCreate var) {
|
||||||
super(obj);
|
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);
|
super(target, thread, frame, n, q, pos, depth);
|
||||||
fMiVar = v;
|
fMIVar = miVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdated(boolean update) {
|
public void setUpdated(boolean update) {
|
||||||
|
@ -105,20 +109,58 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
mgr.update(this);
|
mgr.update(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIVar getMIVar() {
|
public MIVar getMIVar() throws CDIException {
|
||||||
return fMiVar;
|
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) {
|
public Variable getChild(String name) {
|
||||||
for (int i = 0; i < children.length; i++) {
|
for (int i = 0; i < children.length; i++) {
|
||||||
Variable variable = (Variable) children[i];
|
Variable variable = (Variable) children[i];
|
||||||
if (name.equals(variable.getMIVar().getVarName())) {
|
try {
|
||||||
return variable;
|
if (name.equals(variable.getMIVar().getVarName())) {
|
||||||
}
|
return variable;
|
||||||
// Look also in the grandchildren.
|
}
|
||||||
Variable grandChild = variable.getChild(name);
|
// Look also in the grandchildren.
|
||||||
if (grandChild != null) {
|
Variable grandChild = variable.getChild(name);
|
||||||
return grandChild;
|
if (grandChild != null) {
|
||||||
|
return grandChild;
|
||||||
|
}
|
||||||
|
} catch (CDIException e) {
|
||||||
|
// ignore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -432,7 +474,12 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean equals(Variable variable) {
|
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)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -220,6 +220,9 @@ public class RxThread extends Thread {
|
||||||
processMIOOBRecord(rr, list);
|
processMIOOBRecord(rr, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the accumulate console Stream
|
||||||
|
response.setMIOOBRecords(oobRecords);
|
||||||
|
|
||||||
// Notify the waiting command.
|
// Notify the waiting command.
|
||||||
// Notify any command waiting for a ResultRecord.
|
// Notify any command waiting for a ResultRecord.
|
||||||
if (cmd != null) {
|
if (cmd != null) {
|
||||||
|
@ -231,8 +234,6 @@ public class RxThread extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (cmd) {
|
synchronized (cmd) {
|
||||||
// Set the accumulate console Stream
|
|
||||||
response.setMIOOBRecords(oobRecords);
|
|
||||||
cmd.setMIOutput(response);
|
cmd.setMIOutput(response);
|
||||||
cmd.notifyAll();
|
cmd.notifyAll();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue