mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-17 05:55:22 +02:00
[205142] Refactored use of execution, frame, and expression contexts in the MI implementation.
This commit is contained in:
parent
6e8c328c01
commit
d0e0286a8d
6 changed files with 39 additions and 21 deletions
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>).
|
||||||
|
@ -154,15 +154,15 @@ public interface IExpressions extends IFormattedValues {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data model context object for the specified expression in the context
|
* Returns the data model context object for the specified expression in the context
|
||||||
* specified by <b>ctx</b>.
|
* specified by <b>ctx</b>.
|
||||||
*
|
*
|
||||||
* @param ctx: Context in which to evaluate the expression. This context could include the
|
* @param ctx: Context in which to evaluate the expression. This context could include the
|
||||||
* PC location, stack frame, thread, or just a symbol context.
|
* PC location, stack frame, thread, or just a symbol context.
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue