1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-17 14:05:23 +02:00

[205142] Refactored use of execution, frame, and expression contexts in the MI implementation.

This commit is contained in:
Pawel Piech 2007-11-17 00:24:49 +00:00
parent 6e8c328c01
commit d0e0286a8d
6 changed files with 39 additions and 21 deletions

View file

@ -288,7 +288,7 @@ public class MISourceDisplayAdapter implements ISourceDisplay
@Override @Override
public void handleOK() { public void handleOK() {
FramePositioningData clientData = new FramePositioningData(); FramePositioningData clientData = new FramePositioningData();
clientData.fLevel = getData().getLevel(); clientData.fLevel = frameDmc.getLevel();
// Document line numbers are 0-based. While debugger line numbers are 1-based. // Document line numbers are 0-based. While debugger line numbers are 1-based.
clientData.fLine = getData().getLine() - 1; clientData.fLine = getData().getLine() - 1;
rm.setData(clientData); rm.setData(clientData);

View file

@ -212,7 +212,7 @@ public class StackFramesLayoutNode extends AbstractDMVMLayoutNode {
// Add frame number (if total number of frames in known) // Add frame number (if total number of frames in known)
if (fCachedOldFrameVMCs != null) { if (fCachedOldFrameVMCs != null) {
label.append(fCachedOldFrameVMCs.length - dmData.getLevel()); label.append(fCachedOldFrameVMCs.length - dmContext.getLevel());
} }
// Add the function name // Add the function name

View file

@ -13,6 +13,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfExecutor; import org.eclipse.dd.dsf.concurrent.DsfExecutor;
import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor; import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor;
@ -439,19 +441,15 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode implements
@Override @Override
protected void getElementForExpressionPart(IChildrenUpdate update, String expressionPartText, DataRequestMonitor<Object> rm) { protected void getElementForExpressionPart(IChildrenUpdate update, String expressionPartText, DataRequestMonitor<Object> rm) {
/*
* Create a valid DMC for this entered expression.
*/
final IFrameDMContext frameDmc = findDmcInPath(update.getElementPath(), IFrameDMContext.class); final IFrameDMContext frameDmc = findDmcInPath(update.getElementPath(), IFrameDMContext.class);
final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); final IExpressions expressionService = getServicesTracker().getService(IExpressions.class);
IExpressionDMContext expressionDMC = expressionService.createExpression(frameDmc, expressionPartText); if (frameDmc != null) {
IExpressionDMContext expressionDMC = expressionService.createExpression(frameDmc, expressionPartText);
/* rm.setData(createVMContext(expressionDMC));
* Now create the valid VMC which wrappers it. } else {
*/ rm.setStatus(new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
IVMContext vmc = createVMContext(expressionDMC); }
rm.setData(vmc);
rm.done(); rm.done();
} }

View file

@ -51,7 +51,7 @@ public interface IExpressions extends IFormattedValues {
/** /**
* This is the model data interface that corresponds to IExpressionDMContext. * This is the model data interface that corresponds to IExpressionDMContext.
*/ */
interface IExpressionDMData extends IDMData { public interface IExpressionDMData extends IDMData {
// These static fields define the possible return values of method getTypeId(). // These static fields define the possible return values of method getTypeId().
final static String TYPEID_UNKNOWN = "TYPEID_UNKNOWN"; final static String TYPEID_UNKNOWN = "TYPEID_UNKNOWN";
@ -128,7 +128,7 @@ public interface IExpressions extends IFormattedValues {
* Event indicating that a given expression is changed. If an expression is changed, it's implied that all * Event indicating that a given expression is changed. If an expression is changed, it's implied that all
* the children of that expression are changed too. * the children of that expression are changed too.
*/ */
interface IExpressionChangedDMEvent extends IDMEvent<IExpressionDMContext> {} public interface IExpressionChangedDMEvent extends IDMEvent<IExpressionDMContext> {}
/** /**
* Retrieves the expression DM data object for the given expression context(<tt>dmc</tt>). * Retrieves the expression DM data object for the given expression context(<tt>dmc</tt>).
@ -161,8 +161,8 @@ public interface IExpressions extends IFormattedValues {
* *
* @param expression: The expression to evaluate. * @param expression: The expression to evaluate.
* *
* @return An expression data model context object that must be passed to getModelData() to obtain the * @return An expression data model context object that must be passed to
* value of the expression. * getModelData() to obtain the value of the expression.
*/ */
IExpressionDMContext createExpression(IDMContext ctx, String expression); IExpressionDMContext createExpression(IDMContext ctx, String expression);

View file

@ -47,22 +47,41 @@ public interface IRunControl extends IDMService
public enum StateChangeReason { UNKNOWN, USER_REQUEST, STEP, BREAKPOINT, EXCEPTION, CONTAINER, WATCHPOINT, SIGNAL, SHAREDLIB, ERROR }; public enum StateChangeReason { UNKNOWN, USER_REQUEST, STEP, BREAKPOINT, EXCEPTION, CONTAINER, WATCHPOINT, SIGNAL, SHAREDLIB, ERROR };
/** /**
* Events signaling a state changes. * Indicates that the given thread has suspended.
*/ */
public interface ISuspendedDMEvent extends IDMEvent<IExecutionDMContext> { public interface ISuspendedDMEvent extends IDMEvent<IExecutionDMContext> {
StateChangeReason getReason(); StateChangeReason getReason();
} }
/**
* Indicates that the given thread has resumed.
*/
public interface IResumedDMEvent extends IDMEvent<IExecutionDMContext> { public interface IResumedDMEvent extends IDMEvent<IExecutionDMContext> {
StateChangeReason getReason(); StateChangeReason getReason();
} }
/**
* Indicates that the given container has suspended.
*/
public interface IContainerSuspendedDMEvent extends ISuspendedDMEvent { public interface IContainerSuspendedDMEvent extends ISuspendedDMEvent {
IExecutionDMContext getTriggeringContext(); /**
* Returns the context which triggered the resume, which could be
* <code>null</code> if not known.
*/
IExecutionDMContext getTriggeringContext();
} }
/**
* Indicates that the given container has resumed.
*/
public interface IContainerResumedDMEvent extends IResumedDMEvent { public interface IContainerResumedDMEvent extends IResumedDMEvent {
/**
* Returns the context which triggered the resume, which could be
* <code>null</code> if not known.
*/
IExecutionDMContext getTriggeringContext();
} }
/** /**
* Indicates that a new execution context (thread) was started. The DMC * Indicates that a new execution context (thread) was started. The DMC
* for the event is the container of the new exec context. * for the event is the container of the new exec context.

View file

@ -27,13 +27,14 @@ public interface IStack extends IDMService {
* frame data, this context is used by other services that require a stack * frame data, this context is used by other services that require a stack
* frame for evaluation. * frame for evaluation.
*/ */
public interface IFrameDMContext extends IDMContext {} public interface IFrameDMContext extends IDMContext {
int getLevel();
}
/** /**
* Stack frame information. * Stack frame information.
*/ */
public interface IFrameDMData extends IDMData { public interface IFrameDMData extends IDMData {
int getLevel();
IAddress getAddress(); IAddress getAddress();
String getFile(); String getFile();
String getFunction(); String getFunction();