Source:
public String getGDBVersion() throws CoreException { if (fGdbVersion == null) { String cmd = getGDBPath().toOSString() + " --version"; String[] args = CommandLineUtil.argumentsToArray(cmd); Process process = null; Job timeoutJob = null; try { process = ProcessFactory.getFactory().exec(args, getLaunchEnvironment()); final Process finalProc = process; timeoutJob = new Job("GDB version timeout job") { { setSystem(true); } @Override protected IStatus run(IProgressMonitor arg) { finalProc.destroy(); return Status.OK_STATUS; } }; timeoutJob.schedule(10000); String streamOutput = readStream(process.getInputStream()); String gdbVersion = LaunchUtils.getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStream(process.getErrorStream()); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Could not determine GDB version using command: " + StringUtil.join(args, " "), detailedException)); } fGdbVersion = gdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error with command: " + StringUtil.join(args, " "), e)); } finally { if (timeoutJob != null) { timeoutJob.cancel(); } if (process != null) { process.destroy(); } } } return fGdbVersion; }

Target:
public String getGDBVersion() throws CoreException { if (fGdbVersion != null) { return fGdbVersion; } String cmd = getGDBPath().toOSString() + " --version"; String[] args = CommandLineUtil.argumentsToArray(cmd); Process process = null; Job timeoutJob = null; try { process = ProcessFactory.getFactory().exec(args, getLaunchEnvironment()); final Process finalProc = process; timeoutJob = new Job("GDB version timeout job") { { setSystem(true); } @Override protected IStatus run(IProgressMonitor arg) { finalProc.destroy(); return Status.OK_STATUS; } }; timeoutJob.schedule(10000); String streamOutput = readStream(process.getInputStream()); String gdbVersion = LaunchUtils.getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStream(process.getErrorStream()); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Could not determine GDB version using command: " + StringUtil.join(args, " "), detailedException)); } fGdbVersion = gdbVersion; return fGdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error with command: " + StringUtil.join(args, " "), e)); } finally { if (timeoutJob != null) { timeoutJob.cancel(); } if (process != null) { process.destroy(); } } }