/** * This method does the necessary work to setup the input/output streams for the inferior process, * by either preparing the PTY to be used, or by simply leaving the PTY null, which indicates that * the input/output streams of the CLI should be used instead; this decision is based on the type * of session. */ @Execute public void stepInitializeInputOutput(final RequestMonitor rm) { if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) { // Remote non-attach sessions don't support multi-process and therefore will not // start new processes. Those sessions will only start the one process, which should // not have a console, because it's output is handled by GDB server. fPty = null; rm.done(); } else { // Every other type of session that can get to this code, is starting a new process // and requires a pty for it. try { fPty = new PTY(); // Tell GDB to use this PTY fCommandControl.queueCommand( fCommandFactory.createMIInferiorTTYSet( (IMIContainerDMContext) getContainerContext(), fPty.getSlaveName()), new ImmediateDataRequestMonitor<MIInfo>(rm) { @Override protected void handleFailure() { // We were not able to tell GDB to use the PTY // so we won't use it at all. fPty = null; rm.done(); } }); } catch (IOException e) { fPty = null; rm.done(); } } }