1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 338171: StartOrRestartSequence_7_0 is being called for older GDBs

This commit is contained in:
Marc Khouzam 2011-02-25 02:20:34 +00:00
parent 21fb967107
commit 9efc3961a2
6 changed files with 62 additions and 43 deletions

View file

@ -136,7 +136,7 @@ public class GdbRestartCommand implements IRestartHandler {
} catch (CoreException e) {}
procService.restart(containerDmc, attributes,
new RequestMonitor(fExecutor, null) {
new DataRequestMonitor<IContainerDMContext>(fExecutor, null) {
@Override
protected void handleCompleted() {
fRequest.done();

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.ReflectionSequence;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
@ -39,9 +38,11 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
/**
* This sequence is used to start debugging a new process.
*
* @since 4.0
*/
*/
public class DebugNewProcessSequence extends ReflectionSequence {
private final static String INVALID = "invalid"; //$NON-NLS-1$
@ -267,23 +268,20 @@ public class DebugNewProcessSequence extends ReflectionSequence {
@Execute
public void stepStartExecution(final RequestMonitor rm) {
if (fBackend.getSessionType() != SessionType.CORE) {
ImmediateExecutor.getInstance().execute(
getStartOrRestartProcessSequence(
getExecutor(), getContainerContext(), fAttributes, false,
new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm) {
@Override
protected void handleSuccess() {
assert getData() instanceof IMIContainerDMContext;
// Set the container that we created
setContainerContext(DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
fDataRequestMonitor.setData(getContainerContext());
fProcService.start(getContainerContext(), fAttributes, new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm) {
@Override
protected void handleSuccess() {
assert getData() instanceof IMIContainerDMContext;
// Don't call fDataRequestMonitor.done(), the sequence will
// automatically do that when we call rm.done();
rm.done();
}
}));
// Set the container that we created
setContainerContext(DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
fDataRequestMonitor.setData(getContainerContext());
// Don't call fDataRequestMonitor.done(), the sequence will
// automatically do that when it completes;
rm.done();
}
});
} else {
fDataRequestMonitor.setData(getContainerContext());
rm.done();
@ -300,14 +298,4 @@ public class DebugNewProcessSequence extends ReflectionSequence {
fTracker = null;
rm.done();
}
/**
* Return the sequence that is to be used to start or restart the specified process.
* Allows others to extend more easily.
*/
protected Sequence getStartOrRestartProcessSequence(DsfExecutor executor, IContainerDMContext containerDmc,
Map<String, Object> attributes, boolean restart,
DataRequestMonitor<IContainerDMContext> rm) {
return new StartOrRestartProcessSequence_7_0(executor, containerDmc, attributes, restart, rm);
}
}

View file

@ -389,20 +389,26 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
}
/** @since 4.0 */
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, RequestMonitor rm) {
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, true, rm);
}
/** @since 4.0 */
public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
/**
* Insert breakpoint at entry if set, and start or restart the program.
*
* @since 4.0
*/
protected void startOrRestart(final IContainerDMContext containerDmc, Map<String, Object> attributes,
boolean restart, final RequestMonitor requestMonitor) {
boolean restart, final DataRequestMonitor<IContainerDMContext> requestMonitor) {
if (fBackend.getIsAttachSession()) {
// When attaching to a running process, we do not need to set a breakpoint or
// start the program; it is left up to the user.
requestMonitor.setData(containerDmc);
requestMonitor.done();
return;
}
@ -416,7 +422,8 @@ public class GDBProcesses extends MIProcesses implements IGDBProcesses {
// the ^connect
getSession().dispatchEvent(new ContainerStartedDMEvent(containerDmc), getProperties());
}
super.handleSuccess();
requestMonitor.setData(containerDmc);
requestMonitor.done();
}
};

View file

@ -1125,13 +1125,23 @@ public class GDBProcesses_7_0 extends AbstractDsfService
}
/** @since 4.0 */
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, RequestMonitor rm) {
ImmediateExecutor.getInstance().execute(
getStartOrRestartProcessSequence(
getExecutor(), containerDmc, attributes, true,
new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm)));
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, true, rm);
}
/** @since 4.0 */
public void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, false, rm);
}
/** @since 4.0 */
protected void startOrRestart(IContainerDMContext containerDmc, Map<String, Object> attributes,
boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
ImmediateExecutor.getInstance().execute(
getStartOrRestartProcessSequence(
getExecutor(), containerDmc, attributes, restart, rm));
}
/**
* Return the sequence that is to be used to start or restart the specified process.
* Allows others to extend more easily.

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.dsf.gdb.service;
import java.util.Map;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
@ -72,9 +71,24 @@ public interface IGDBProcesses extends IMIProcesses {
* @param containerDmc The process that should be restarted
* @param attributes Different attributes that affect the restart operation. This is
* usually the launch configuration attributes
* @param rm The requetMonitor that indicates that the restart request has been completed.
* @param rm The requetMonitor that indicates that the restart request has been completed. It will
* contain the IContainerDMContext fully filled with the data of the restarted process.
*
* @since 4.0
*/
void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, RequestMonitor rm);
void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm);
/**
* Request that the specified process be started.
*
* @param containerDmc The process that should be started.
* @param attributes Different attributes that affect the start operation. This is
* usually the launch configuration attributes
* @param rm The requestMonitor that indicates that the start request has been completed. It will
* contain the IContainerDMContext fully filled with the data of the newly started process.
*
* @since 4.0
*/
void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm);
}

View file

@ -621,9 +621,9 @@ public class SyncUtil {
MIStoppedEvent.class);
// Perform the restart
Query<Object> query2 = new Query<Object>() {
Query<IContainerDMContext> query2 = new Query<IContainerDMContext>() {
@Override
protected void execute(final DataRequestMonitor<Object> rm) {
protected void execute(final DataRequestMonitor<IContainerDMContext> rm) {
fGdbControl.initInferiorInputOutput(new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
@SuppressWarnings("unchecked")
@Override