diff --git a/plugins/org.eclipse.dd.gdb.launch/plugin.xml b/plugins/org.eclipse.dd.gdb.launch/plugin.xml index 4b4a09485e8..cc2a0d580d0 100644 --- a/plugins/org.eclipse.dd.gdb.launch/plugin.xml +++ b/plugins/org.eclipse.dd.gdb.launch/plugin.xml @@ -12,7 +12,7 @@ modes="debug"> (getExecutor(), requestMonitor)); + } else { + if (!getSerialDevice(requestMonitor)) return; + + fCommandControl.queueCommand( + new MITargetSelect((IContainerDMContext)fCommandControl.getControlDMContext(), + fSerialDevice), + new DataRequestMonitor(getExecutor(), requestMonitor)); + } + } else { + requestMonitor.done(); + } + + } + }, + /* Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging) */ + new Step() { @Override + public void execute(final RequestMonitor requestMonitor) { + fBpmService.startTrackingBreakpoints(fCommandControl.getGDBDMContext(), requestMonitor); + }}, /* * If needed, insert breakpoint at main and run to it. */ @@ -161,18 +262,18 @@ public class LaunchSequence extends Sequence { @Override public void execute(final RequestMonitor requestMonitor) { + final MICommand execCommand; + if (fSessionType == SessionType.REMOTE) { + // When doing remote debugging, we use -exec-continue instead of -exec-run + execCommand = new MIExecContinue((IContainerDMContext)fCommandControl.getControlDMContext()); + } else { + execCommand = new MIExecRun((IContainerDMContext)fCommandControl.getControlDMContext(), new String[0]); + } + if (!readStopAtMain(requestMonitor)) return; if (!fStopInMain) { // Just start the program. - fCommandControl.queueCommand( - new MIExecRun((IContainerDMContext)fCommandControl.getControlDMContext(), new String[0]), - new DataRequestMonitor(getExecutor(), requestMonitor) { - @Override - protected void handleOK() { - requestMonitor.done(); - } - } - ); + fCommandControl.queueCommand(execCommand, new DataRequestMonitor(getExecutor(), requestMonitor)); } else { if (!readStopSymbol(requestMonitor)) return; @@ -185,16 +286,8 @@ public class LaunchSequence extends Sequence { @Override protected void handleOK() { - // After the break-insert is done, execute the -exec-run command. - fCommandControl.queueCommand( - new MIExecRun((IContainerDMContext)fCommandControl.getControlDMContext(), new String[0]), - new DataRequestMonitor(getExecutor(), requestMonitor) { - @Override - protected void handleOK() { - requestMonitor.done(); - } - } - ); + // After the break-insert is done, execute the -exec-run or -exec-continue command. + fCommandControl.queueCommand(execCommand, new DataRequestMonitor(getExecutor(), requestMonitor)); } }); } @@ -205,9 +298,11 @@ public class LaunchSequence extends Sequence { DsfSession fSession; GdbLaunch fLaunch; IPath fExecPath; + SessionType fSessionType; GDBControl fCommandControl; CSourceLookup fSourceLookup; + MIBreakpointsManager fBpmService; public LaunchSequence(DsfSession session, GdbLaunch launch, IPath execPath) { super(session.getExecutor()); diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/service/command/GDBControl.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/service/command/GDBControl.java index ea79486a158..0e33727fc38 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/service/command/GDBControl.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/service/command/GDBControl.java @@ -86,7 +86,7 @@ public class GDBControl extends AbstractMIControl { private static int fgInstanceCounter = 0; private final GDBControlDMContext fControlDmc; - public enum SessionType { RUN, ATTACH, CORE } + public enum SessionType { RUN, ATTACH, CORE, REMOTE } private SessionType fSessionType; private boolean fConnected = false; diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MITargetSelect.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MITargetSelect.java index 80b5bc84c37..e0071c19626 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MITargetSelect.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MITargetSelect.java @@ -14,11 +14,16 @@ import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.mi.service.command.output.MIInfo; /** - * This command connects to a remote target using TCP/IP. + * This command connects to a remote target. */ public class MITargetSelect extends MICommand { public MITargetSelect(IDMContext ctx, String host, String port) { super(ctx, "-target-select extended-remote " + host + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$ } + + public MITargetSelect(IDMContext ctx, String serialDevice) { + super(ctx, "-target-select extended-remote " + serialDevice); //$NON-NLS-1$ + } + }