mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
2004-10-24 Alain Magloire
Changes in ICDITarget.evaluateExpressionToString() * org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
This commit is contained in:
parent
815b892f7f
commit
9dffa53757
5 changed files with 43 additions and 19 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-10-24 Alain Magloire
|
||||||
|
Changes in ICDITarget.evaluateExpressionToString()
|
||||||
|
* org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
|
||||||
|
|
||||||
2004-10-20 Alain Magloire
|
2004-10-20 Alain Magloire
|
||||||
Use the new ICDIDebugger interface
|
Use the new ICDIDebugger interface
|
||||||
|
|
||||||
|
|
|
@ -142,10 +142,10 @@ public class ExpressionManager extends Manager implements ICDIExpressionManager{
|
||||||
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
|
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
|
||||||
Expression expression = null;
|
Expression expression = null;
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
Target target = (Target)frame.getTarget();
|
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
session.setCurrentTarget(target);
|
session.setCurrentTarget(target);
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
|
|
|
@ -457,10 +457,10 @@ public class SourceManager extends Manager implements ICDISourceManager {
|
||||||
|
|
||||||
public String getDetailTypeName(ICDIStackFrame frame, String typename) throws CDIException {
|
public String getDetailTypeName(ICDIStackFrame frame, String typename) throws CDIException {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
Target target = (Target)frame.getTarget();
|
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
session.setCurrentTarget(target);
|
session.setCurrentTarget(target);
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
|
@ -490,10 +490,10 @@ public class SourceManager extends Manager implements ICDISourceManager {
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = null;
|
ICDIThread currentThread = null;
|
||||||
ICDIStackFrame currentFrame = null;
|
ICDIStackFrame currentFrame = null;
|
||||||
session.setCurrentTarget(target);
|
|
||||||
if (frame != null) {
|
if (frame != null) {
|
||||||
currentThread = target.getCurrentThread();
|
currentThread = currentTarget.getCurrentThread();
|
||||||
currentFrame = currentThread.getCurrentStackFrame();
|
currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
session.setCurrentTarget(target);
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,10 +151,10 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|
||||||
public void checkType(StackFrame frame, String type) throws CDIException {
|
public void checkType(StackFrame frame, String type) throws CDIException {
|
||||||
if (type != null && type.length() > 0) {
|
if (type != null && type.length() > 0) {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
Target target = (Target)frame.getTarget();
|
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
session.setCurrentTarget(target);
|
session.setCurrentTarget(target);
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
|
@ -238,7 +238,7 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|
||||||
Target target = (Target)argObj.getTarget();
|
Target target = (Target)argObj.getTarget();
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
currentThread = target.getCurrentThread();
|
currentThread = currentTarget.getCurrentThread();
|
||||||
currentFrame = currentThread.getCurrentStackFrame();
|
currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
stack.getThread().setCurrentStackFrame(stack, false);
|
stack.getThread().setCurrentStackFrame(stack, false);
|
||||||
|
@ -276,10 +276,10 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|
||||||
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
|
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
List argObjects = new ArrayList();
|
List argObjects = new ArrayList();
|
||||||
Session session = (Session) getSession();
|
Session session = (Session) getSession();
|
||||||
Target target = (Target)frame.getTarget();
|
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
|
@ -406,10 +406,10 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|
||||||
public ICDIVariableObject[] getLocalVariableObjects(ICDIStackFrame frame) throws CDIException {
|
public ICDIVariableObject[] getLocalVariableObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
List varObjects = new ArrayList();
|
List varObjects = new ArrayList();
|
||||||
Session session = (Session) getSession();
|
Session session = (Session) getSession();
|
||||||
Target target = (Target)frame.getTarget();
|
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
frame.getThread().setCurrentStackFrame(frame, false);
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
|
@ -471,7 +471,7 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|
||||||
Target target = (Target)varObj.getTarget();
|
Target target = (Target)varObj.getTarget();
|
||||||
Target currentTarget = session.getCurrentTarget();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
currentThread = target.getCurrentThread();
|
currentThread = currentTarget.getCurrentThread();
|
||||||
currentFrame = currentThread.getCurrentStackFrame();
|
currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
stack.getThread().setCurrentStackFrame(stack, false);
|
stack.getThread().setCurrentStackFrame(stack, false);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
|
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.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||||
|
@ -627,12 +628,27 @@ public class Target implements ICDITarget {
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String)
|
||||||
*/
|
*/
|
||||||
public String evaluateExpressionToString(String expressionText)
|
public String evaluateExpressionToString(String expressionText) throws CDIException {
|
||||||
throws CDIException {
|
Session session = (Session)getSession();
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
Target currentTarget = session.getCurrentTarget();
|
||||||
MIDataEvaluateExpression evaluate =
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
factory.createMIDataEvaluateExpression(expressionText);
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
return evaluateExpressionToString(currentFrame, expressionText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String evaluateExpressionToString(ICDIStackFrame frame, String expressionText) throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
Target currentTarget = session.getCurrentTarget();
|
||||||
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
Target target = (Target)frame.getTarget();
|
||||||
|
session.setCurrentTarget(target);
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
frame.getThread().setCurrentStackFrame(frame, false);
|
||||||
try {
|
try {
|
||||||
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
|
MIDataEvaluateExpression evaluate =
|
||||||
|
factory.createMIDataEvaluateExpression(expressionText);
|
||||||
miSession.postCommand(evaluate);
|
miSession.postCommand(evaluate);
|
||||||
MIDataEvaluateExpressionInfo info =
|
MIDataEvaluateExpressionInfo info =
|
||||||
evaluate.getMIDataEvaluateExpressionInfo();
|
evaluate.getMIDataEvaluateExpressionInfo();
|
||||||
|
@ -642,6 +658,10 @@ public class Target implements ICDITarget {
|
||||||
return info.getExpression();
|
return info.getExpression();
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
session.setCurrentTarget(currentTarget);
|
||||||
|
target.setCurrentThread(currentThread, false);
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue