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

Bug 237800

This commit is contained in:
Marc Khouzam 2008-06-19 19:58:59 +00:00
parent fe8e5b4dde
commit 4d078d0bc6
3 changed files with 35 additions and 12 deletions

View file

@ -38,6 +38,7 @@ import org.eclipse.dd.mi.service.command.commands.MIExecStep;
import org.eclipse.dd.mi.service.command.commands.MIExecStepInstruction; import org.eclipse.dd.mi.service.command.commands.MIExecStepInstruction;
import org.eclipse.dd.mi.service.command.commands.MIExecUntil; import org.eclipse.dd.mi.service.command.commands.MIExecUntil;
import org.eclipse.dd.mi.service.command.commands.MIThreadListIds; import org.eclipse.dd.mi.service.command.commands.MIThreadListIds;
import org.eclipse.dd.mi.service.command.events.IMIDMEvent;
import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent;
import org.eclipse.dd.mi.service.command.events.MIErrorEvent; import org.eclipse.dd.mi.service.command.events.MIErrorEvent;
import org.eclipse.dd.mi.service.command.events.MIEvent; import org.eclipse.dd.mi.service.command.events.MIEvent;
@ -137,7 +138,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
*/ */
@Immutable @Immutable
protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V> protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
implements IDMEvent<V> implements IDMEvent<V>, IMIDMEvent<T>
{ {
final private T fMIInfo; final private T fMIInfo;
public RunControlEvent(V dmc, T miInfo) { public RunControlEvent(V dmc, T miInfo) {

View file

@ -27,16 +27,18 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.AbstractDMContext; import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
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.IDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl;
import org.eclipse.dd.dsf.debug.service.IStack; import org.eclipse.dd.dsf.debug.service.IStack;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason; import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.dd.dsf.debug.service.command.CommandCache; import org.eclipse.dd.dsf.debug.service.command.CommandCache;
import org.eclipse.dd.dsf.debug.service.command.ICommandControl;
import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.AbstractDsfService;
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.mi.internal.MIPlugin; import org.eclipse.dd.mi.internal.MIPlugin;
import org.eclipse.dd.mi.service.MIRunControl.SuspendedEvent;
import org.eclipse.dd.mi.service.command.AbstractMIControl;
import org.eclipse.dd.mi.service.command.commands.MIStackInfoDepth; import org.eclipse.dd.mi.service.command.commands.MIStackInfoDepth;
import org.eclipse.dd.mi.service.command.commands.MIStackListArguments; import org.eclipse.dd.mi.service.command.commands.MIStackListArguments;
import org.eclipse.dd.mi.service.command.commands.MIStackListFrames; import org.eclipse.dd.mi.service.command.commands.MIStackListFrames;
@ -144,7 +146,10 @@ public class MIStack extends AbstractDsfService
} }
private void doInitialize(RequestMonitor rm) { private void doInitialize(RequestMonitor rm) {
fMICommandCache = new CommandCache(getSession(), getServicesTracker().getService(ICommandControl.class)); AbstractMIControl miControl = getServicesTracker().getService(AbstractMIControl.class);
fMICommandCache = new CommandCache(getSession(), miControl);
fMICommandCache.setContextAvailable(miControl.getControlDMContext(), true);
getSession().addServiceEventListener(this, null); getSession().addServiceEventListener(this, null);
register(new String[]{IStack.class.getName(), MIStack.class.getName()}, new Hashtable<String,String>()); register(new String[]{IStack.class.getName(), MIStack.class.getName()}, new Hashtable<String,String>());
rm.done(); rm.done();
@ -575,7 +580,7 @@ public class MIStack extends AbstractDsfService
// IServiceEventListener // IServiceEventListener
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IRunControl.IResumedDMEvent e) { public void eventDispatched(IResumedDMEvent e) {
fMICommandCache.setContextAvailable(e.getDMContext(), false); fMICommandCache.setContextAvailable(e.getDMContext(), false);
if (e.getReason() != StateChangeReason.STEP) { if (e.getReason() != StateChangeReason.STEP) {
fCachedStoppedEvent = null; fCachedStoppedEvent = null;
@ -584,14 +589,11 @@ public class MIStack extends AbstractDsfService
} }
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IRunControl.ISuspendedDMEvent e) { public void eventDispatched(ISuspendedDMEvent e) {
fMICommandCache.setContextAvailable(e.getDMContext(), true); fMICommandCache.setContextAvailable(e.getDMContext(), true);
fMICommandCache.reset(); fMICommandCache.reset();
if (e instanceof SuspendedEvent) {
fCachedStoppedEvent = ((SuspendedEvent)e).getMIEvent();
}
} }
@DsfServiceEventHandler
public void eventDispatched(MIRunControl.ContainerSuspendedEvent e) {
fCachedStoppedEvent = e.getMIEvent();
}
} }

View file

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2008 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.mi.service.command.events;
import org.eclipse.dd.dsf.datamodel.IDMContext;
/**
* Common interface for events that are directly caused by some MI event.
*/
public interface IMIDMEvent<V extends MIEvent<? extends IDMContext>> {
public V getMIEvent();
}