mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[224435] Changed the IContainerSuspendedDMEvent/IContainerResumedEvent.getTriggeringContext() to return an array instead of a single context.
This commit is contained in:
parent
e42dcea7a8
commit
d5f39af5a8
4 changed files with 60 additions and 50 deletions
|
@ -330,11 +330,18 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
|||
|
||||
public void buildDelta(final Object e, final VMDelta parent, final int nodeOffset, final RequestMonitor rm) {
|
||||
if (e instanceof IContainerSuspendedDMEvent) {
|
||||
IExecutionDMContext threadDmc = null;
|
||||
IContainerSuspendedDMEvent csEvent = (IContainerSuspendedDMEvent)e;
|
||||
|
||||
IExecutionDMContext triggeringCtx = csEvent.getTriggeringContexts().length != 0
|
||||
? csEvent.getTriggeringContexts()[0] : null;
|
||||
|
||||
if (parent.getElement() instanceof IDMVMContext) {
|
||||
IExecutionDMContext threadDmc = null;
|
||||
threadDmc = DMContexts.getAncestorOfType( ((IDMVMContext)parent.getElement()).getDMContext(), IExecutionDMContext.class);
|
||||
buildDeltaForSuspendedEvent((ISuspendedDMEvent)e, threadDmc, triggeringCtx, parent, nodeOffset, rm);
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
buildDeltaForSuspendedEvent((ISuspendedDMEvent)e, threadDmc, ((IContainerSuspendedDMEvent)e).getTriggeringContext(), parent, nodeOffset, rm);
|
||||
} else if (e instanceof ISuspendedDMEvent) {
|
||||
IExecutionDMContext execDmc = ((ISuspendedDMEvent)e).getDMContext();
|
||||
buildDeltaForSuspendedEvent((ISuspendedDMEvent)e, execDmc, execDmc, parent, nodeOffset, rm);
|
||||
|
@ -361,7 +368,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
|||
// Refresh the whole list of stack frames unless the target is already stepping the next command. In
|
||||
// which case, the refresh will occur when the stepping sequence slows down or stops. Trying to
|
||||
// refresh the whole stack trace with every step would slow down stepping too much.
|
||||
if (!runControlService.isStepping(triggeringCtx)) {
|
||||
if (triggeringCtx == null || !runControlService.isStepping(triggeringCtx)) {
|
||||
parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@ public interface IRunControl extends IDMService
|
|||
*/
|
||||
public interface IContainerSuspendedDMEvent extends ISuspendedDMEvent {
|
||||
/**
|
||||
* Returns the context which triggered the resume, which could be
|
||||
* <code>null</code> if not known.
|
||||
* Returns the contexts which triggered the resume, which could be
|
||||
* an empty array if not known.
|
||||
*/
|
||||
IExecutionDMContext getTriggeringContext();
|
||||
IExecutionDMContext[] getTriggeringContexts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,10 +76,10 @@ public interface IRunControl extends IDMService
|
|||
*/
|
||||
public interface IContainerResumedDMEvent extends IResumedDMEvent {
|
||||
/**
|
||||
* Returns the context which triggered the resume, which could be
|
||||
* <code>null</code> if not known.
|
||||
* Returns the contexts which triggered the resume, which could be an
|
||||
* empty array if not known.
|
||||
*/
|
||||
IExecutionDMContext getTriggeringContext();
|
||||
IExecutionDMContext[] getTriggeringContexts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
|||
import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
|
@ -101,16 +100,16 @@ public class ThreadVMNode extends AbstractDMVMNode
|
|||
@Override
|
||||
public void getContextsForEvent(VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) {
|
||||
if(e instanceof IContainerResumedDMEvent) {
|
||||
IDMContext triggerContext = ((IContainerResumedDMEvent)e).getTriggeringContext();
|
||||
if (triggerContext != null) {
|
||||
rm.setData(new IVMContext[] { createVMContext(triggerContext) });
|
||||
IExecutionDMContext[] triggerContexts = ((IContainerResumedDMEvent)e).getTriggeringContexts();
|
||||
if (triggerContexts.length != 0) {
|
||||
rm.setData(new IVMContext[] { createVMContext(triggerContexts[0]) });
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
} else if(e instanceof IContainerSuspendedDMEvent) {
|
||||
IDMContext triggerContext = ((IContainerSuspendedDMEvent)e).getTriggeringContext();
|
||||
if (triggerContext != null) {
|
||||
rm.setData(new IVMContext[] { createVMContext(triggerContext) });
|
||||
IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
|
||||
if (triggerContexts.length != 0) {
|
||||
rm.setData(new IVMContext[] { createVMContext(triggerContexts[0]) });
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
@ -274,15 +273,15 @@ public class ThreadVMNode extends AbstractDMVMNode
|
|||
|
||||
public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
|
||||
if(e instanceof IContainerResumedDMEvent) {
|
||||
IDMContext triggeringContext = ((IContainerResumedDMEvent)e).getTriggeringContext();
|
||||
if (triggeringContext != null) {
|
||||
parentDelta.addNode(createVMContext(triggeringContext), IModelDelta.CONTENT);
|
||||
IExecutionDMContext[] triggeringContexts = ((IContainerResumedDMEvent)e).getTriggeringContexts();
|
||||
if (triggeringContexts.length != 0) {
|
||||
parentDelta.addNode(createVMContext(triggeringContexts[0]), IModelDelta.CONTENT);
|
||||
}
|
||||
rm.done();
|
||||
} else if (e instanceof IContainerSuspendedDMEvent) {
|
||||
IDMContext triggeringContext = ((IContainerSuspendedDMEvent)e).getTriggeringContext();
|
||||
if (triggeringContext != null) {
|
||||
parentDelta.addNode(createVMContext(triggeringContext), IModelDelta.CONTENT);
|
||||
IExecutionDMContext[] triggeringContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
|
||||
if (triggeringContexts.length != 0) {
|
||||
parentDelta.addNode(createVMContext(triggeringContexts[0]), IModelDelta.CONTENT);
|
||||
}
|
||||
rm.done();
|
||||
} else if(e instanceof IResumedDMEvent || e instanceof ISuspendedDMEvent) {
|
||||
|
|
|
@ -180,14 +180,15 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
protected static class ContainerSuspendedEvent extends SuspendedEvent
|
||||
implements IContainerSuspendedDMEvent
|
||||
{
|
||||
final IExecutionDMContext triggeringDmc;
|
||||
final IExecutionDMContext[] triggeringDmcs;
|
||||
ContainerSuspendedEvent(IContainerDMContext containerDmc, MIStoppedEvent miInfo, IExecutionDMContext triggeringDmc) {
|
||||
super(containerDmc, miInfo);
|
||||
this.triggeringDmc = triggeringDmc;
|
||||
this.triggeringDmcs = triggeringDmc != null
|
||||
? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
|
||||
}
|
||||
|
||||
public IExecutionDMContext getTriggeringContext() {
|
||||
return triggeringDmc;
|
||||
public IExecutionDMContext[] getTriggeringContexts() {
|
||||
return triggeringDmcs;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,15 +224,16 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
protected static class ContainerResumedEvent extends ResumedEvent
|
||||
implements IContainerResumedDMEvent
|
||||
{
|
||||
final IExecutionDMContext triggeringDmc;
|
||||
final IExecutionDMContext[] triggeringDmcs;
|
||||
|
||||
ContainerResumedEvent(IContainerDMContext containerDmc, MIRunningEvent miInfo, IExecutionDMContext triggeringDmc) {
|
||||
super(containerDmc, miInfo);
|
||||
this.triggeringDmc = triggeringDmc;
|
||||
this.triggeringDmcs = triggeringDmc != null
|
||||
? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
|
||||
}
|
||||
|
||||
public IExecutionDMContext getTriggeringContext() {
|
||||
return triggeringDmc;
|
||||
public IExecutionDMContext[] getTriggeringContexts() {
|
||||
return triggeringDmcs;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +396,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
fMICommandCache.setContextAvailable(e.getDMContext(), true);
|
||||
fMICommandCache.reset();
|
||||
fStateChangeReason = e.getReason();
|
||||
fStateChangeTriggeringContext = e.getTriggeringContext();
|
||||
fStateChangeTriggeringContext = e.getTriggeringContexts().length != 0
|
||||
? e.getTriggeringContexts()[0] : null;
|
||||
fSuspended = true;
|
||||
fStepping = false;
|
||||
}
|
||||
|
@ -427,11 +430,21 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IRunControl
|
||||
public boolean canResume(IExecutionDMContext context) {
|
||||
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
rm.setData(doCanResume(context));
|
||||
rm.done();
|
||||
}
|
||||
|
||||
private boolean doCanResume(IExecutionDMContext context) {
|
||||
return !fTerminated && isSuspended(context) && !fResumePending;
|
||||
}
|
||||
|
||||
public boolean canSuspend(IExecutionDMContext context) {
|
||||
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
rm.setData(doCanSuspend(context));
|
||||
rm.done();
|
||||
}
|
||||
|
||||
private boolean doCanSuspend(IExecutionDMContext context) {
|
||||
return !fTerminated && !isSuspended(context);
|
||||
}
|
||||
|
||||
|
@ -446,7 +459,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
public void resume(IExecutionDMContext context, final RequestMonitor rm) {
|
||||
assert context != null;
|
||||
|
||||
if (canResume(context)) {
|
||||
if (doCanResume(context)) {
|
||||
fResumePending = true;
|
||||
// Cygwin GDB will accept commands and execute them after the step
|
||||
// which is not what we want, so mark the target as unavailable
|
||||
|
@ -482,7 +495,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
public void suspend(IExecutionDMContext context, final RequestMonitor rm){
|
||||
assert context != null;
|
||||
|
||||
if (canSuspend(context)) {
|
||||
if (doCanSuspend(context)) {
|
||||
MIExecInterrupt cmd = null;
|
||||
if(context instanceof IContainerDMContext){
|
||||
cmd = new MIExecInterrupt(context);
|
||||
|
@ -511,8 +524,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
}
|
||||
}
|
||||
|
||||
public boolean canStep(IExecutionDMContext context, StepType stepType) {
|
||||
return canResume(context);
|
||||
public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
|
||||
canResume(context, rm);
|
||||
}
|
||||
|
||||
public void step(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
|
||||
|
@ -525,7 +538,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
return;
|
||||
}
|
||||
|
||||
if (!canResume(context)) {
|
||||
if (!doCanResume(context)) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
|
@ -567,15 +580,6 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
}
|
||||
}
|
||||
|
||||
public boolean canInstructionStep(IExecutionDMContext context, StepType stepType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void instructionStep(IExecutionDMContext context, StepType stepType, RequestMonitor rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, NOT_SUPPORTED, "Operation not implemented", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
|
||||
fMICommandCache.execute(
|
||||
new MIThreadListIds(containerDmc),
|
||||
|
@ -631,7 +635,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
return;
|
||||
}
|
||||
|
||||
if (canResume(context)) {
|
||||
if (doCanResume(context)) {
|
||||
fResumePending = true;
|
||||
fMICommandCache.setContextAvailable(context, false);
|
||||
fConnection.queueCommand(new MIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue