mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
No need to cast to a StackFrame nor Thread.
This commit is contained in:
parent
e44439b1a2
commit
1d53f62a9b
3 changed files with 34 additions and 46 deletions
|
@ -17,9 +17,8 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.*;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject;
|
||||||
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.MIVarCreate;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||||
|
@ -52,8 +51,6 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
|
||||||
try {
|
try {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
//ICDIThread currentThread = currentTarget.getCurrentThread();
|
|
||||||
//StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
@ -76,14 +73,11 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
|
||||||
*/
|
*/
|
||||||
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
|
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
|
||||||
Expression expression = null;
|
Expression expression = null;
|
||||||
if (!(frame instanceof StackFrame)) {
|
|
||||||
return expression;
|
|
||||||
}
|
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = currentTarget.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
frame.getThread().setCurrentStackFrame(frame);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -93,14 +87,14 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
}
|
}
|
||||||
ICDITarget target = frame.getThread().getTarget();
|
ICDITarget tgt = frame.getThread().getTarget();
|
||||||
VariableObject varObj = new VariableObject(target, name, (StackFrame)frame, 0, 0);
|
VariableObject varObj = new VariableObject(tgt, name, frame, 0, 0);
|
||||||
expression = new Expression(varObj, info.getMIVar());
|
expression = new Expression(varObj, info.getMIVar());
|
||||||
addExpression(expression);
|
addExpression(expression);
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
currentThread.setCurrentStackFrame(currentFrame);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
}
|
}
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,15 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.*;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Argument;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Argument;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentObject;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject;
|
||||||
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.MIStackListArguments;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
|
||||||
|
@ -164,15 +164,15 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
}
|
}
|
||||||
if (argument == null) {
|
if (argument == null) {
|
||||||
String name = argObj.getName();
|
String name = argObj.getName();
|
||||||
StackFrame stack = argObj.getStackFrame();
|
ICDIStackFrame stack = argObj.getStackFrame();
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
Thread currentThread = null;
|
ICDIThread currentThread = null;
|
||||||
StackFrame currentFrame = null;
|
ICDIStackFrame currentFrame = null;
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
currentThread = (Thread)currentTarget.getCurrentThread();
|
currentThread = currentTarget.getCurrentThread();
|
||||||
currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
currentFrame = currentThread.getCurrentStackFrame();
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
stack.getThread().setCurrentStackFrame(stack, false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
|
@ -216,15 +216,12 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getArgumentObjects(ICDIStackFrame)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getArgumentObjects(ICDIStackFrame)
|
||||||
*/
|
*/
|
||||||
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
|
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
if (!(frame instanceof StackFrame)) {
|
|
||||||
return new ICDIArgumentObject[0];
|
|
||||||
}
|
|
||||||
List argObjects = new ArrayList();
|
List argObjects = new ArrayList();
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
((Thread)(frame.getThread())).setCurrentStackFrame((StackFrame)frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -243,10 +240,10 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
args = miFrames[0].getArgs();
|
args = miFrames[0].getArgs();
|
||||||
}
|
}
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
ICDITarget target = frame.getThread().getTarget();
|
ICDITarget tgt = frame.getThread().getTarget();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
ArgumentObject arg = new ArgumentObject(target, args[i].getName(),
|
ArgumentObject arg = new ArgumentObject(tgt, args[i].getName(),
|
||||||
(StackFrame)frame, args.length - i, depth);
|
frame, args.length - i, depth);
|
||||||
argObjects.add(arg);
|
argObjects.add(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,15 +297,12 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame)
|
||||||
*/
|
*/
|
||||||
public ICDIVariableObject[] getVariableObjects(ICDIStackFrame frame) throws CDIException {
|
public ICDIVariableObject[] getVariableObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
if (!(frame instanceof StackFrame)) {
|
|
||||||
return new ICDIVariableObject[0];
|
|
||||||
}
|
|
||||||
List varObjects = new ArrayList();
|
List varObjects = new ArrayList();
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
((Thread)(frame.getThread())).setCurrentStackFrame((StackFrame)frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -322,17 +316,17 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
}
|
}
|
||||||
args = info.getLocals();
|
args = info.getLocals();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
ICDITarget target = frame.getThread().getTarget();
|
ICDITarget tgt = frame.getThread().getTarget();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
VariableObject varObj = new VariableObject(target, args[i].getName(),
|
VariableObject varObj = new VariableObject(tgt, args[i].getName(),
|
||||||
(StackFrame)frame, args.length - i, depth);
|
frame, args.length - i, depth);
|
||||||
varObjects.add(varObj);
|
varObjects.add(varObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
currentThread.setCurrentStackFrame((StackFrame)currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
}
|
}
|
||||||
return (ICDIVariableObject[])varObjects.toArray(new ICDIVariableObject[0]);
|
return (ICDIVariableObject[])varObjects.toArray(new ICDIVariableObject[0]);
|
||||||
}
|
}
|
||||||
|
@ -347,14 +341,14 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
||||||
if (variable == null) {
|
if (variable == null) {
|
||||||
String name = varObj.getName();
|
String name = varObj.getName();
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
StackFrame stack = varObj.getStackFrame();
|
ICDIStackFrame stack = varObj.getStackFrame();
|
||||||
Thread currentThread = null;
|
ICDIThread currentThread = null;
|
||||||
StackFrame currentFrame = null;
|
ICDIStackFrame currentFrame = null;
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
currentThread = (Thread)currentTarget.getCurrentThread();
|
currentThread = currentTarget.getCurrentThread();
|
||||||
currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
currentFrame = currentThread.getCurrentStackFrame();
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
stack.getThread().setCurrentStackFrame(stack, false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class Value extends CObject implements ICDIValue {
|
||||||
variables = new Variable[vars.length];
|
variables = new Variable[vars.length];
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
VariableObject varObj = new VariableObject(getTarget(),
|
VariableObject varObj = new VariableObject(getTarget(),
|
||||||
vars[i].getExp(), (StackFrame)variable.getStackFrame(),
|
vars[i].getExp(), variable.getStackFrame(),
|
||||||
variable.getVariableObject().getPosition(),
|
variable.getVariableObject().getPosition(),
|
||||||
variable.getVariableObject().getStackDepth());
|
variable.getVariableObject().getStackDepth());
|
||||||
variables[i] = mgr.createVariable(varObj, vars[i]);
|
variables[i] = mgr.createVariable(varObj, vars[i]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue