Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2009-09-01 10:49:55 -0400
committerAlena Laskavaia2009-09-01 10:49:55 -0400
commit723abf1e211c073eca23f58f7a42f5de5ba2a39b (patch)
treef666d033ced424d818c853169ac3c70f3f18a595 /debug/org.eclipse.cdt.debug.mi.core
parent07f340d6702da3055ae576e4febd3463da56fecf (diff)
downloadorg.eclipse.cdt-723abf1e211c073eca23f58f7a42f5de5ba2a39b.tar.gz
org.eclipse.cdt-723abf1e211c073eca23f58f7a42f5de5ba2a39b.tar.xz
org.eclipse.cdt-723abf1e211c073eca23f58f7a42f5de5ba2a39b.zip
[287927] - fixed lost console output during gdb initialisation
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java38
1 files changed, 4 insertions, 34 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java
index 678503a665..7c3dd967fe 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIProcessAdapter.java
@@ -11,12 +11,9 @@
package org.eclipse.cdt.debug.mi.core;
-import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.io.Reader;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.cdt.utils.spawner.Spawner;
@@ -50,38 +47,16 @@ public class MIProcessAdapter implements MIProcess {
*/
protected Process getGDBProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException {
final Process pgdb = ProcessFactory.getFactory().exec(args);
- Thread syncStartup = new Thread("GDB Start") { //$NON-NLS-1$
- public void run() {
- try {
- String line;
- InputStream stream = pgdb.getInputStream();
- Reader r = new InputStreamReader(stream);
- BufferedReader reader = new BufferedReader(r);
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- //System.out.println("GDB " + line);
- if (line.endsWith("(gdb)")) { //$NON-NLS-1$
- break;
- }
- }
- } catch (Exception e) {
- // Do nothing, ignore the errors
- }
- }
- };
- syncStartup.start();
int timepass = 0;
if (launchTimeout <= 0) {
// Simulate we are waiting forever.
launchTimeout = Integer.MAX_VALUE;
}
-
- // To respect the IProgressMonitor we can not use wait/notify
- // instead we have to loop and check for the monitor to allow to cancel the thread.
- // The monitor is check every 1 second delay;
+
+ InputStream stream = pgdb.getInputStream();
for (timepass = 0; timepass < launchTimeout; timepass += ONE_SECOND) {
- if (syncStartup.isAlive() && !monitor.isCanceled()) {
+ if (stream.available()<=0 && !monitor.isCanceled()) {
try {
Thread.sleep(ONE_SECOND);
} catch (InterruptedException e) {
@@ -91,12 +66,7 @@ public class MIProcessAdapter implements MIProcess {
break;
}
}
- try {
- syncStartup.interrupt();
- syncStartup.join(ONE_SECOND);
- } catch (InterruptedException e) {
- // ignore
- }
+
if (monitor.isCanceled()) {
pgdb.destroy();
throw new OperationCanceledException();

Back to the top