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

Bug 348043: GDB (DSF) Hardware Debugging Launcher fails to complete launch

This commit is contained in:
Marc Khouzam 2011-06-03 09:32:51 +00:00
parent e096ea087e
commit da7276ed66
3 changed files with 25 additions and 6 deletions

View file

@ -38,6 +38,8 @@ import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
import org.eclipse.cdt.debug.mi.core.command.MICommand;
import org.eclipse.cdt.debug.mi.core.command.Command;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
@ -59,6 +61,8 @@ import org.eclipse.debug.core.ILaunchConfiguration;
*/
public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
private String miVersion;
public ICDISession createSession(ILaunch launch, File executable,
IProgressMonitor monitor) throws CoreException {
return super.createSession(launch, executable, monitor);
@ -71,7 +75,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
protected CommandFactory getCommandFactory(ILaunchConfiguration config)
throws CoreException {
String miVersion = MIPlugin.getMIVersion(config);
miVersion = MIPlugin.getMIVersion(config);
return new GDBJtagCommandFactory(miVersion);
}
@ -333,13 +337,18 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
for (int j = 0; j < commands.length; ++j) {
try {
submonitor.subTask(Messages.getString("GDBJtagDebugger.21") + commands[j]); //$NON-NLS-1$
CLICommand cli = new CLICommand(commands[j]);
miSession.postCommand(cli, MISession.FOREVER);
Command cmd = null;
if (commands[j].startsWith("-")) {
cmd = new MICommand(miVersion, commands[j]);
} else {
cmd = new CLICommand(commands[j]);
}
miSession.postCommand(cmd, MISession.FOREVER);
submonitor.worked(1);
if (submonitor.isCanceled()) {
throw new OperationCanceledException();
}
MIInfo info = cli.getMIInfo();
MIInfo info = cmd.getMIInfo();
if (info == null) {
throw new MIException("Timeout"); //$NON-NLS-1$
}

View file

@ -37,7 +37,12 @@ public class DefaultGDBJtagConnectionImpl extends DefaultGDBJtagDeviceImpl imple
public void doRemote(String connection, Collection<String> commands) {
String cmd = ""; //$NON-NLS-1$
if (connection != null) {
cmd = "target remote " + connection; //$NON-NLS-1$
// The CLI version (target remote) does not let us know
// that we have properly connected. For older GDBs (<= 6.8)
// we need this information for a DSF session.
// The MI version does tell us, which is why we must use it
// Bug 348043
cmd = "-target-select remote " + connection; //$NON-NLS-1$
addCmd(commands, cmd);
}
}

View file

@ -52,7 +52,12 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice {
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doRemote(java.lang.String, int, java.util.Collection)
*/
public void doRemote(String ip, int port, Collection<String> commands) {
String cmd = "target remote " + ip + ":" + String.valueOf(port); //$NON-NLS-1$ //$NON-NLS-2$
// The CLI version (target remote) does not let us know
// that we have properly connected. For older GDBs (<= 6.8)
// we need this information for a DSF session.
// The MI version does tell us, which is why we must use it
// Bug 348043
String cmd = "-target-select remote " + ip + ":" + String.valueOf(port); //$NON-NLS-1$ //$NON-NLS-2$
addCmd(commands, cmd);
}