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

[214389] - [source lookup][debug view] After terminating a suspended process, the IP remains in editor.

This commit is contained in:
Pawel Piech 2008-05-02 22:05:46 +00:00
parent b80e85ffde
commit 409994f93a
7 changed files with 109 additions and 22 deletions

View file

@ -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.getDMContext()); startAnnotationClearingJob(e.getDMContext());
} }
@DsfServiceEventHandler @DsfServiceEventHandler
@ -549,6 +549,9 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(IRunControl.ISuspendedDMEvent e) { public void eventDispatched(IRunControl.ISuspendedDMEvent e) {
if (e.getReason() == StateChangeReason.STEP) {
startAnnotationClearingJob(e.getDMContext());
}
fPrevModelContext = null; fPrevModelContext = null;
} }
} }

View file

@ -31,7 +31,7 @@ import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl;
import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl.GDBProcessData; import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl.GDBProcessData;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.StartedEvent; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.GDBStartedEvent;
import org.eclipse.dd.mi.service.command.AbstractMIControl; import org.eclipse.dd.mi.service.command.AbstractMIControl;
import org.eclipse.dd.mi.service.command.MIControlDMContext; import org.eclipse.dd.mi.service.command.MIControlDMContext;
import org.eclipse.dd.mi.service.command.events.MIInferiorExitEvent; import org.eclipse.dd.mi.service.command.events.MIInferiorExitEvent;
@ -121,13 +121,13 @@ public class ContainerVMNode extends AbstractDMVMNode
e instanceof IRunControl.IContainerSuspendedDMEvent) e instanceof IRunControl.IContainerSuspendedDMEvent)
{ {
return IModelDelta.CONTENT; return IModelDelta.CONTENT;
} else if (e instanceof GDBControl.ExitedEvent || } else if (e instanceof GDBControl.GDBExitedEvent ||
e instanceof MIInferiorExitEvent || e instanceof MIInferiorExitEvent ||
e instanceof MIInferiorSignalExitEvent) e instanceof MIInferiorSignalExitEvent)
{ {
return IModelDelta.CONTENT; return IModelDelta.CONTENT;
} }
if (e instanceof StartedEvent) { if (e instanceof GDBStartedEvent) {
return IModelDelta.EXPAND | IModelDelta.SELECT; return IModelDelta.EXPAND | IModelDelta.SELECT;
} }
return IModelDelta.NO_CHANGE; return IModelDelta.NO_CHANGE;
@ -144,13 +144,13 @@ public class ContainerVMNode extends AbstractDMVMNode
if (containerCtx != null) { if (containerCtx != null) {
parentDelta.addNode(createVMContext(containerCtx), IModelDelta.CONTENT); parentDelta.addNode(createVMContext(containerCtx), IModelDelta.CONTENT);
} }
} else if (e instanceof GDBControl.ExitedEvent || } else if (e instanceof GDBControl.GDBExitedEvent ||
e instanceof MIInferiorExitEvent || e instanceof MIInferiorExitEvent ||
e instanceof MIInferiorSignalExitEvent) e instanceof MIInferiorSignalExitEvent)
{ {
parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT); parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.CONTENT);
} }
if (e instanceof StartedEvent) { if (e instanceof GDBStartedEvent) {
parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.EXPAND | IModelDelta.SELECT); parentDelta.addNode(createVMContext(((IDMEvent<?>)e).getDMContext()), IModelDelta.EXPAND | IModelDelta.SELECT);
} }

View file

@ -174,7 +174,7 @@ public class GdbLaunch extends Launch
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// IServiceEventListener // IServiceEventListener
@DsfServiceEventHandler public void eventDispatched(GDBControl.ExitedEvent event) { @DsfServiceEventHandler public void eventDispatched(GDBControl.GDBExitedEvent event) {
shutdownSession(new RequestMonitor(ImmediateExecutor.getInstance(), null)); shutdownSession(new RequestMonitor(ImmediateExecutor.getInstance(), null));
} }

View file

@ -143,7 +143,7 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
// The initializeControl method should be called after the GdbControl class has // The initializeControl method should be called after the GdbControl class has
// be initialized (in the ServicesLaunchSequence above.) This is because it is the // be initialized (in the ServicesLaunchSequence above.) This is because it is the
// GdbControl class that will trigger the launch cleanup through a GDBControl.ExitedEvent // GdbControl class that will trigger the launch cleanup through a GDBControl.GDBExitedEvent
launch.initializeControl(); launch.initializeControl();
// Add the CLI and "inferior" process objects to the launch. // Add the CLI and "inferior" process objects to the launch.

View file

@ -50,6 +50,7 @@ import org.eclipse.dd.mi.service.command.CLIEventProcessor;
import org.eclipse.dd.mi.service.command.MIControlDMContext; import org.eclipse.dd.mi.service.command.MIControlDMContext;
import org.eclipse.dd.mi.service.command.MIInferiorProcess; import org.eclipse.dd.mi.service.command.MIInferiorProcess;
import org.eclipse.dd.mi.service.command.MIRunControlEventProcessor; import org.eclipse.dd.mi.service.command.MIRunControlEventProcessor;
import org.eclipse.dd.mi.service.command.MIInferiorProcess.InferiorStartedDMEvent;
import org.eclipse.dd.mi.service.command.commands.MIBreakInsert; import org.eclipse.dd.mi.service.command.commands.MIBreakInsert;
import org.eclipse.dd.mi.service.command.commands.MICommand; import org.eclipse.dd.mi.service.command.commands.MICommand;
import org.eclipse.dd.mi.service.command.commands.MIExecContinue; import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
@ -73,18 +74,17 @@ public class GDBControl extends AbstractMIControl {
/** /**
* Event indicating that the back end process process has started. * Event indicating that the back end process process has started.
*/ */
public static class StartedEvent extends AbstractDMEvent<GDBControlDMContext> { public static class GDBStartedEvent extends AbstractDMEvent<GDBControlDMContext> {
public StartedEvent(GDBControlDMContext context) { public GDBStartedEvent(GDBControlDMContext context) {
super(context); super(context);
} }
} }
/** /**
* Event indicating that the back end process has terminated. * Event indicating that the back end process has terminated.
*/ */
public static class ExitedEvent extends AbstractDMEvent<GDBControlDMContext> { public static class GDBExitedEvent extends AbstractDMEvent<GDBControlDMContext> {
public ExitedEvent(GDBControlDMContext context) { public GDBExitedEvent(GDBControlDMContext context) {
super(context); super(context);
} }
} }
@ -351,7 +351,16 @@ public class GDBControl extends AbstractMIControl {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
// After the break-insert is done, execute the -exec-run or -exec-continue command. // After the break-insert is done, execute the -exec-run or -exec-continue command.
queueCommand(execCommand, new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); queueCommand(
execCommand,
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
getSession().dispatchEvent(
new InferiorStartedDMEvent(getGDBDMContext()), getProperties());
super.handleSuccess();
}
});
} }
}); });
} }
@ -406,7 +415,7 @@ public class GDBControl extends AbstractMIControl {
} }
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(ExitedEvent e) { public void eventDispatched(GDBExitedEvent e) {
// Handle our "GDB Exited" event and stop processing commands. // Handle our "GDB Exited" event and stop processing commands.
stopCommandProcessing(); stopCommandProcessing();
} }
@ -433,7 +442,7 @@ public class GDBControl extends AbstractMIControl {
Thread.interrupted(); Thread.interrupted();
} finally { } finally {
fExited = true; fExited = true;
getSession().dispatchEvent(new ExitedEvent(fControlDmc) {}, getProperties()); getSession().dispatchEvent(new GDBExitedEvent(fControlDmc) {}, getProperties());
} }
} }
} }
@ -705,7 +714,7 @@ public class GDBControl extends AbstractMIControl {
public void initialize(final RequestMonitor requestMonitor) { public void initialize(final RequestMonitor requestMonitor) {
getSession().addServiceEventListener(GDBControl.this, null); getSession().addServiceEventListener(GDBControl.this, null);
register(new String[]{ ICommandControl.class.getName(), AbstractMIControl.class.getName() }, new Hashtable<String,String>()); register(new String[]{ ICommandControl.class.getName(), AbstractMIControl.class.getName() }, new Hashtable<String,String>());
getSession().dispatchEvent(new StartedEvent(getGDBDMContext()), getProperties()); getSession().dispatchEvent(new GDBStartedEvent(getGDBDMContext()), getProperties());
requestMonitor.done(); requestMonitor.done();
} }

View file

@ -27,11 +27,11 @@ class GDBInferiorProcess extends MIInferiorProcess {
public GDBInferiorProcess(GDBControl commandControl, PTY p) { public GDBInferiorProcess(GDBControl commandControl, PTY p) {
super(commandControl, p); super(commandControl, commandControl.getGDBDMContext(), p);
} }
public GDBInferiorProcess(GDBControl commandControl, OutputStream gdbOutputStream) { public GDBInferiorProcess(GDBControl commandControl, OutputStream gdbOutputStream) {
super(commandControl, gdbOutputStream); super(commandControl, commandControl.getGDBDMContext(), gdbOutputStream);
} }
@Override @Override

View file

@ -32,6 +32,10 @@ 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.ImmediateExecutor; import org.eclipse.dd.dsf.concurrent.ImmediateExecutor;
import org.eclipse.dd.dsf.concurrent.Query; import org.eclipse.dd.dsf.concurrent.Query;
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
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.command.ICommandListener; import org.eclipse.dd.dsf.debug.service.command.ICommandListener;
import org.eclipse.dd.dsf.debug.service.command.ICommandResult; import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
import org.eclipse.dd.dsf.debug.service.command.ICommandToken; import org.eclipse.dd.dsf.debug.service.command.ICommandToken;
@ -62,6 +66,31 @@ import org.eclipse.dd.mi.service.command.output.MIValue;
public class MIInferiorProcess extends Process public class MIInferiorProcess extends Process
implements IEventListener, ICommandListener implements IEventListener, ICommandListener
{ {
/**
* Event indicating that the GDB inferior process has started. This event
* implements the {@link IStartedMDEvent} from the IRunControl service.
*/
public static class InferiorStartedDMEvent extends AbstractDMEvent<IExecutionDMContext>
implements IStartedDMEvent
{
public InferiorStartedDMEvent(IExecutionDMContext context) {
super(context);
}
}
/**
* Event indicating that the GDB inferior process has exited. This event
* implements the {@link IExitedMDEvent} from the IRunControl service.
*/
public static class InferiorExitedDMEvent extends AbstractDMEvent<IExecutionDMContext>
implements IExitedDMEvent
{
public InferiorExitedDMEvent(IExecutionDMContext context) {
super(context);
}
}
public enum State { RUNNING, STOPPED, TERMINATED } public enum State { RUNNING, STOPPED, TERMINATED }
private final OutputStream fOutputStream; private final OutputStream fOutputStream;
@ -77,6 +106,8 @@ public class MIInferiorProcess extends Process
private final AbstractMIControl fCommandControl; private final AbstractMIControl fCommandControl;
private final IExecutionDMContext fExecutionDMContext;
@ConfinedToDsfExecutor("fSession#getExecutor") @ConfinedToDsfExecutor("fSession#getExecutor")
private boolean fDisposed = false; private boolean fDisposed = false;
@ -100,20 +131,59 @@ public class MIInferiorProcess extends Process
int inferiorPID; int inferiorPID;
/**
* Creates an inferior process object which uses the given output stream
* to write the user standard input into.
*
* @param commandControl Command control that this inferior process belongs to.
* @param inferiorExecCtx The execution context controlling the execution
* state of the inferior process.
* @param gdbOutputStream The output stream to use to write user IO into.
*/
@ConfinedToDsfExecutor("fSession#getExecutor") @ConfinedToDsfExecutor("fSession#getExecutor")
public MIInferiorProcess(AbstractMIControl commandControl, IExecutionDMContext inferiorExecCtx, OutputStream gdbOutputStream) {
this(commandControl, inferiorExecCtx, gdbOutputStream, null);
}
/**
* @deprecated {@link #MIInferiorProcess(AbstractMIControl, IExecutionDMContext, OutputStream)}
* should be used instead.
*/
@ConfinedToDsfExecutor("fSession#getExecutor")
@Deprecated
public MIInferiorProcess(AbstractMIControl commandControl, OutputStream gdbOutputStream) { public MIInferiorProcess(AbstractMIControl commandControl, OutputStream gdbOutputStream) {
this(commandControl, gdbOutputStream, null); this(commandControl, null, gdbOutputStream, null);
} }
/**
* Creates an inferior process object which uses the given terminal
* to write the user standard input into.
*
* @param commandControl Command control that this inferior process belongs to.
* @param inferiorExecCtx The execution context controlling the execution
* state of the inferior process.
* @param p The terminal to use to write user IO into.
*/
@ConfinedToDsfExecutor("fSession#getExecutor") @ConfinedToDsfExecutor("fSession#getExecutor")
public MIInferiorProcess(AbstractMIControl commandControl, IExecutionDMContext inferiorExecCtx, PTY p) {
this(commandControl, inferiorExecCtx, null, p);
}
/**
* @deprecated Should use {@link #MIInferiorProcess(AbstractMIControl, IExecutionDMContext, PTY)}
* instead.
*/
@ConfinedToDsfExecutor("fSession#getExecutor")
@Deprecated
public MIInferiorProcess(AbstractMIControl commandControl, PTY p) { public MIInferiorProcess(AbstractMIControl commandControl, PTY p) {
this(commandControl, null, p); this(commandControl, null, null, p);
} }
@ConfinedToDsfExecutor("fSession#getExecutor") @ConfinedToDsfExecutor("fSession#getExecutor")
private MIInferiorProcess(AbstractMIControl commandControl, final OutputStream gdbOutputStream, PTY p) { private MIInferiorProcess(AbstractMIControl commandControl, IExecutionDMContext execCtx, final OutputStream gdbOutputStream, PTY p) {
fCommandControl = commandControl; fCommandControl = commandControl;
fSession = commandControl.getSession(); fSession = commandControl.getSession();
fExecutionDMContext = execCtx;
commandControl.addEventListener(this); commandControl.addEventListener(this);
commandControl.addCommandListener(this); commandControl.addCommandListener(this);
@ -327,6 +397,11 @@ public class MIInferiorProcess extends Process
if (fState == State.TERMINATED) return; if (fState == State.TERMINATED) return;
fState = state; fState = state;
if (fState == State.TERMINATED) { if (fState == State.TERMINATED) {
if (fExecutionDMContext != null) {
getSession().dispatchEvent(
new InferiorExitedDMEvent(fExecutionDMContext),
fCommandControl.getProperties());
}
closeIO(); closeIO();
} }
notifyAll(); notifyAll();