1
0
Fork 0
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:
Pawel Piech 2008-03-28 18:05:54 +00:00
parent e42dcea7a8
commit d5f39af5a8
4 changed files with 60 additions and 50 deletions

View file

@ -330,11 +330,18 @@ public class StackFramesVMNode extends AbstractDMVMNode
public void buildDelta(final Object e, final VMDelta parent, final int nodeOffset, final RequestMonitor rm) { public void buildDelta(final Object e, final VMDelta parent, final int nodeOffset, final RequestMonitor rm) {
if (e instanceof IContainerSuspendedDMEvent) { 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) { if (parent.getElement() instanceof IDMVMContext) {
IExecutionDMContext threadDmc = null;
threadDmc = DMContexts.getAncestorOfType( ((IDMVMContext)parent.getElement()).getDMContext(), IExecutionDMContext.class); 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) { } else if (e instanceof ISuspendedDMEvent) {
IExecutionDMContext execDmc = ((ISuspendedDMEvent)e).getDMContext(); IExecutionDMContext execDmc = ((ISuspendedDMEvent)e).getDMContext();
buildDeltaForSuspendedEvent((ISuspendedDMEvent)e, execDmc, execDmc, parent, nodeOffset, rm); 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 // 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 // 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. // 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); parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);
} }

View file

@ -65,10 +65,10 @@ public interface IRunControl extends IDMService
*/ */
public interface IContainerSuspendedDMEvent extends ISuspendedDMEvent { public interface IContainerSuspendedDMEvent extends ISuspendedDMEvent {
/** /**
* Returns the context which triggered the resume, which could be * Returns the contexts which triggered the resume, which could be
* <code>null</code> if not known. * an empty array if not known.
*/ */
IExecutionDMContext getTriggeringContext(); IExecutionDMContext[] getTriggeringContexts();
} }
/** /**
@ -76,10 +76,10 @@ public interface IRunControl extends IDMService
*/ */
public interface IContainerResumedDMEvent extends IResumedDMEvent { public interface IContainerResumedDMEvent extends IResumedDMEvent {
/** /**
* Returns the context which triggered the resume, which could be * Returns the contexts which triggered the resume, which could be an
* <code>null</code> if not known. * empty array if not known.
*/ */
IExecutionDMContext getTriggeringContext(); IExecutionDMContext[] getTriggeringContexts();
} }
/** /**

View file

@ -21,7 +21,6 @@ import org.eclipse.dd.dsf.concurrent.DsfRunnable;
import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants; import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.DMContexts; 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.datamodel.IDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRunControl;
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
@ -101,16 +100,16 @@ public class ThreadVMNode extends AbstractDMVMNode
@Override @Override
public void getContextsForEvent(VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) { public void getContextsForEvent(VMDelta parentDelta, Object e, final DataRequestMonitor<IVMContext[]> rm) {
if(e instanceof IContainerResumedDMEvent) { if(e instanceof IContainerResumedDMEvent) {
IDMContext triggerContext = ((IContainerResumedDMEvent)e).getTriggeringContext(); IExecutionDMContext[] triggerContexts = ((IContainerResumedDMEvent)e).getTriggeringContexts();
if (triggerContext != null) { if (triggerContexts.length != 0) {
rm.setData(new IVMContext[] { createVMContext(triggerContext) }); rm.setData(new IVMContext[] { createVMContext(triggerContexts[0]) });
rm.done(); rm.done();
return; return;
} }
} else if(e instanceof IContainerSuspendedDMEvent) { } else if(e instanceof IContainerSuspendedDMEvent) {
IDMContext triggerContext = ((IContainerSuspendedDMEvent)e).getTriggeringContext(); IExecutionDMContext[] triggerContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
if (triggerContext != null) { if (triggerContexts.length != 0) {
rm.setData(new IVMContext[] { createVMContext(triggerContext) }); rm.setData(new IVMContext[] { createVMContext(triggerContexts[0]) });
rm.done(); rm.done();
return; return;
} }
@ -274,15 +273,15 @@ public class ThreadVMNode extends AbstractDMVMNode
public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) { public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
if(e instanceof IContainerResumedDMEvent) { if(e instanceof IContainerResumedDMEvent) {
IDMContext triggeringContext = ((IContainerResumedDMEvent)e).getTriggeringContext(); IExecutionDMContext[] triggeringContexts = ((IContainerResumedDMEvent)e).getTriggeringContexts();
if (triggeringContext != null) { if (triggeringContexts.length != 0) {
parentDelta.addNode(createVMContext(triggeringContext), IModelDelta.CONTENT); parentDelta.addNode(createVMContext(triggeringContexts[0]), IModelDelta.CONTENT);
} }
rm.done(); rm.done();
} else if (e instanceof IContainerSuspendedDMEvent) { } else if (e instanceof IContainerSuspendedDMEvent) {
IDMContext triggeringContext = ((IContainerSuspendedDMEvent)e).getTriggeringContext(); IExecutionDMContext[] triggeringContexts = ((IContainerSuspendedDMEvent)e).getTriggeringContexts();
if (triggeringContext != null) { if (triggeringContexts.length != 0) {
parentDelta.addNode(createVMContext(triggeringContext), IModelDelta.CONTENT); parentDelta.addNode(createVMContext(triggeringContexts[0]), IModelDelta.CONTENT);
} }
rm.done(); rm.done();
} else if(e instanceof IResumedDMEvent || e instanceof ISuspendedDMEvent) { } else if(e instanceof IResumedDMEvent || e instanceof ISuspendedDMEvent) {

View file

@ -180,14 +180,15 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
protected static class ContainerSuspendedEvent extends SuspendedEvent protected static class ContainerSuspendedEvent extends SuspendedEvent
implements IContainerSuspendedDMEvent implements IContainerSuspendedDMEvent
{ {
final IExecutionDMContext triggeringDmc; final IExecutionDMContext[] triggeringDmcs;
ContainerSuspendedEvent(IContainerDMContext containerDmc, MIStoppedEvent miInfo, IExecutionDMContext triggeringDmc) { ContainerSuspendedEvent(IContainerDMContext containerDmc, MIStoppedEvent miInfo, IExecutionDMContext triggeringDmc) {
super(containerDmc, miInfo); super(containerDmc, miInfo);
this.triggeringDmc = triggeringDmc; this.triggeringDmcs = triggeringDmc != null
? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
} }
public IExecutionDMContext getTriggeringContext() { public IExecutionDMContext[] getTriggeringContexts() {
return triggeringDmc; return triggeringDmcs;
} }
} }
@ -223,15 +224,16 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
protected static class ContainerResumedEvent extends ResumedEvent protected static class ContainerResumedEvent extends ResumedEvent
implements IContainerResumedDMEvent implements IContainerResumedDMEvent
{ {
final IExecutionDMContext triggeringDmc; final IExecutionDMContext[] triggeringDmcs;
ContainerResumedEvent(IContainerDMContext containerDmc, MIRunningEvent miInfo, IExecutionDMContext triggeringDmc) { ContainerResumedEvent(IContainerDMContext containerDmc, MIRunningEvent miInfo, IExecutionDMContext triggeringDmc) {
super(containerDmc, miInfo); super(containerDmc, miInfo);
this.triggeringDmc = triggeringDmc; this.triggeringDmcs = triggeringDmc != null
? new IExecutionDMContext[] { triggeringDmc } : new IExecutionDMContext[0];
} }
public IExecutionDMContext getTriggeringContext() { public IExecutionDMContext[] getTriggeringContexts() {
return triggeringDmc; return triggeringDmcs;
} }
} }
@ -394,7 +396,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
fMICommandCache.setContextAvailable(e.getDMContext(), true); fMICommandCache.setContextAvailable(e.getDMContext(), true);
fMICommandCache.reset(); fMICommandCache.reset();
fStateChangeReason = e.getReason(); fStateChangeReason = e.getReason();
fStateChangeTriggeringContext = e.getTriggeringContext(); fStateChangeTriggeringContext = e.getTriggeringContexts().length != 0
? e.getTriggeringContexts()[0] : null;
fSuspended = true; fSuspended = true;
fStepping = false; fStepping = false;
} }
@ -427,11 +430,21 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 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; 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); return !fTerminated && !isSuspended(context);
} }
@ -446,7 +459,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
public void resume(IExecutionDMContext context, final RequestMonitor rm) { public void resume(IExecutionDMContext context, final RequestMonitor rm) {
assert context != null; assert context != null;
if (canResume(context)) { if (doCanResume(context)) {
fResumePending = true; fResumePending = true;
// Cygwin GDB will accept commands and execute them after the step // Cygwin GDB will accept commands and execute them after the step
// which is not what we want, so mark the target as unavailable // 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){ public void suspend(IExecutionDMContext context, final RequestMonitor rm){
assert context != null; assert context != null;
if (canSuspend(context)) { if (doCanSuspend(context)) {
MIExecInterrupt cmd = null; MIExecInterrupt cmd = null;
if(context instanceof IContainerDMContext){ if(context instanceof IContainerDMContext){
cmd = new MIExecInterrupt(context); cmd = new MIExecInterrupt(context);
@ -511,8 +524,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
} }
} }
public boolean canStep(IExecutionDMContext context, StepType stepType) { public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
return canResume(context); canResume(context, rm);
} }
public void step(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) { public void step(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
@ -525,7 +538,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
return; 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.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INVALID_STATE, "Cannot resume context", null)); //$NON-NLS-1$
rm.done(); rm.done();
return; 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) { public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
fMICommandCache.execute( fMICommandCache.execute(
new MIThreadListIds(containerDmc), new MIThreadListIds(containerDmc),
@ -631,7 +635,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
return; return;
} }
if (canResume(context)) { if (doCanResume(context)) {
fResumePending = true; fResumePending = true;
fMICommandCache.setContextAvailable(context, false); fMICommandCache.setContextAvailable(context, false);
fConnection.queueCommand(new MIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$ fConnection.queueCommand(new MIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$