HashMap<Object, Object> processAttributes = new HashMap<Object, Object>();
processAttributes.put(IProcess.ATTR_CMDLINE, config.getCommandLineAsString());
processAttributes.put(Constants.PYDEV_DEBUG_IPROCESS_ATTR, Constants.PYDEV_DEBUG_IPROCESS_ATTR_TRUE);
//Set the debug target before registering with the debug plugin (we want it before creating the console).
PyDebugTarget t = new PyDebugTarget(launch, null, config.resource, debugger, config.project);
IProcess process;
try {
process = registerWithDebugPluginForProcessType(config.getRunningName(), launch, p, processAttributes,
config);
t.process = process;
} finally {
t.finishedInit = true;
}
subMonitor.subTask("Waiting for connection...");
Socket socket = null;
try {
socket = debugger.waitForConnect(subMonitor, p, process);
if (socket == null) {
debugger.dispose();
return;
}
} catch (Exception ex) {
process.terminate();
p.destroy();
String message = "Unexpected error setting up the debugger";
if (ex instanceof SocketTimeoutException)
message = "Timed out after " + Float.toString(config.acceptTimeout / 1000)
+ " seconds while waiting for python script to connect.";
throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex));
}
subMonitor.subTask("Done");
// hook up debug model, and we are off & running
launch.setSourceLocator(new PySourceLocator());
t.startTransmission(socket); // this starts reading/writing from sockets
t.initialize();
t.addConsoleInputListener();
}