1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[224434] Changed the context used in IRunControl.IStartedDMEvent and IRunControl.IExitedDMEvent events.

This commit is contained in:
Pawel Piech 2008-03-27 22:09:11 +00:00
parent 506cc50df7
commit c50257d07d
5 changed files with 30 additions and 46 deletions

View file

@ -502,10 +502,10 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay
} }
private void startAnnotationClearingJob(IRunControl.IExecutionDMContext execDmc) { private void startAnnotationClearingJob(IRunControl.IExecutionDMContext execDmc) {
// Make sure to add the dmc to the list. // Make sure to add the context to the list.
fPendingExecDmcsToClear.add(execDmc); fPendingExecDmcsToClear.add(execDmc);
// If lookup job is running, check it agains the exec context, // If lookup job is running, check it against the execution context,
// and cancel it if matches. // and cancel it if matches.
if (fRunningLookupJob != null) { if (fRunningLookupJob != null) {
if (DMContexts.isAncestorOf(fRunningLookupJob.getDmc(), execDmc)) { if (DMContexts.isAncestorOf(fRunningLookupJob.getDmc(), execDmc)) {
@ -513,8 +513,8 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay
fRunningLookupJob = null; fRunningLookupJob = null;
} }
} }
// If there is a pending displahy job, make sure it doesn't get // If there is a pending display job, make sure it doesn't get
// pre-empted by this event. If so, just cancel the pending // preempted by this event. If so, just cancel the pending
// display job. // display job.
if (fPendingDisplayJob != null) { if (fPendingDisplayJob != null) {
if (DMContexts.isAncestorOf(fPendingDisplayJob.getDmc(), execDmc)) { if (DMContexts.isAncestorOf(fPendingDisplayJob.getDmc(), execDmc)) {
@ -539,7 +539,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IRunControl.IExitedDMEvent e) { public void eventDispatched(IRunControl.IExitedDMEvent e) {
startAnnotationClearingJob(e.getExecutionContext()); startAnnotationClearingJob(e.getDMContext());
} }
@DsfServiceEventHandler @DsfServiceEventHandler

View file

@ -83,20 +83,14 @@ public interface IRunControl extends IDMService
} }
/** /**
* Indicates that a new execution context (thread) was started. The DMC * Indicates that a new execution context (thread) was started.
* for the event is the container of the new exec context.
*/ */
public interface IStartedDMEvent extends IDMEvent<IContainerDMContext> { public interface IStartedDMEvent extends IDMEvent<IExecutionDMContext> {}
IExecutionDMContext getExecutionContext();
}
/** /**
* Indicates that an execution context has exited. As in the started event, * Indicates that an execution context has exited.
* the DMC for the event is the container of the exec context.
*/ */
public interface IExitedDMEvent extends IDMEvent<IContainerDMContext> { public interface IExitedDMEvent extends IDMEvent<IExecutionDMContext> {}
IExecutionDMContext getExecutionContext();
}
/** /**
* Display information for an execution context. * Display information for an execution context.

View file

@ -17,8 +17,10 @@ import java.util.concurrent.RejectedExecutionException;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.concurrent.DsfRunnable;
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.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.IExitedDMEvent; import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent; import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
@ -124,13 +126,16 @@ public class ContainerVMNode extends AbstractDMVMNode
} }
public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
if(e instanceof IRunControl.IContainerResumedDMEvent || if(e instanceof IRunControl.IContainerResumedDMEvent ||
e instanceof IRunControl.IContainerSuspendedDMEvent) e instanceof IRunControl.IContainerSuspendedDMEvent)
{ {
parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT); parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT);
} else if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) { } else if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) {
parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT); IContainerDMContext containerCtx = DMContexts.getAncestorOfType(
((IDMEvent<?>)e).getDMContext(), IContainerDMContext.class);
if (containerCtx != null) {
parentDelta.addNode(createVMContext(containerCtx), IModelDelta.CONTENT);
}
} else if (e instanceof GDBControl.ExitedEvent || } else if (e instanceof GDBControl.ExitedEvent ||
e instanceof MIInferiorExitEvent || e instanceof MIInferiorExitEvent ||
e instanceof MIInferiorSignalExitEvent) e instanceof MIInferiorSignalExitEvent)

View file

@ -236,35 +236,20 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
} }
@Immutable @Immutable
protected static class StartedDMEvent extends RunControlEvent<IContainerDMContext,MIThreadCreatedEvent> protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
implements IStartedDMEvent{ implements IStartedDMEvent
{
private final IMIExecutionDMContext fExecutionDmc; StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
super(executionDmc, miInfo);
StartedDMEvent(IContainerDMContext containerDmc, IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
super(containerDmc, miInfo);
fExecutionDmc = executionDmc;
} }
public IExecutionDMContext getExecutionContext(){
return fExecutionDmc;
}
} }
@Immutable @Immutable
protected static class ExitedDMEvent extends RunControlEvent<IContainerDMContext,MIThreadExitEvent> protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
implements IExitedDMEvent{ implements IExitedDMEvent
{
private final IMIExecutionDMContext fExecutionDmc; ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
super(executionDmc, miInfo);
ExitedDMEvent(IContainerDMContext containerDmc, IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
super(containerDmc, miInfo);
fExecutionDmc = executionDmc;
}
public IExecutionDMContext getExecutionContext(){
return fExecutionDmc;
} }
} }
@ -375,7 +360,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
public void eventDispatched(final MIThreadCreatedEvent e) { public void eventDispatched(final MIThreadCreatedEvent e) {
IContainerDMContext containerDmc = e.getDMContext(); IContainerDMContext containerDmc = e.getDMContext();
IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null; IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null;
getSession().dispatchEvent(new StartedDMEvent(containerDmc, executionCtx, e), getProperties()); getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
} }
// //
@ -386,7 +371,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
public void eventDispatched(final MIThreadExitEvent e) { public void eventDispatched(final MIThreadExitEvent e) {
IContainerDMContext containerDmc = e.getDMContext(); IContainerDMContext containerDmc = e.getDMContext();
IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null; IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null;
getSession().dispatchEvent(new ExitedDMEvent(containerDmc, executionCtx, e), getProperties()); getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
} }
@DsfServiceEventHandler @DsfServiceEventHandler
@ -430,7 +415,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
// Event handler when a thread is destroyed // Event handler when a thread is destroyed
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(ExitedDMEvent e) { public void eventDispatched(ExitedDMEvent e) {
fMICommandCache.reset(e.getExecutionContext()); fMICommandCache.reset(e.getDMContext());
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View file

@ -438,7 +438,7 @@ public class MIRunControlTest extends BaseTestCase {
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IStartedDMEvent e) { public void eventDispatched(IStartedDMEvent e) {
if(fIsTestingThreadCreateEvent){ if(fIsTestingThreadCreateEvent){
if(((IMIExecutionDMContext)e.getExecutionContext()).getThreadId() != 2) if(((IMIExecutionDMContext)e.getDMContext()).getThreadId() != 2)
/* /*
* Set variable if thread create event is unsuccesful * Set variable if thread create event is unsuccesful
*/ */