Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2011-05-27 02:34:42 +0000
committerMarc Khouzam2011-05-27 02:34:42 +0000
commit587d3cee4c3fedd13fe214bf026a535dfa5afc0e (patch)
tree33e8b1f3edf12e0fd05696fa467f3c7c5093eb6c /dsf-gdb/org.eclipse.cdt.dsf.gdb
parent6c08d0dc7d3a39cf0d4ff0e2f4f0245ddc7977af (diff)
downloadorg.eclipse.cdt-587d3cee4c3fedd13fe214bf026a535dfa5afc0e.tar.gz
org.eclipse.cdt-587d3cee4c3fedd13fe214bf026a535dfa5afc0e.tar.xz
org.eclipse.cdt-587d3cee4c3fedd13fe214bf026a535dfa5afc0e.zip
Bug 339379 : Instruction pointer is not always removed when terminating launch. Fix for GDB >= 7.0
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java20
2 files changed, 22 insertions, 17 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
index 6857aaf99df..f54e30acdab 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
@@ -442,23 +442,10 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
}
public void destroy() {
- // We are responsible for closing the streams we have used or else
- // we will leak pipes.
- // Bug 345164
- try {
- getMIOutputStream().close();
- } catch (IOException e) {}
- try {
- getMIInputStream().close();
- } catch (IOException e) {}
+ // Don't close the streams ourselves as it may be too early.
+ // Wait for the actual user of the streams to close it.
+ // Bug 339379
- // We do access GDB's error stream and must
- // close it.
- // Bug 327617
- try {
- fProcess.getErrorStream().close();
- } catch (IOException e) {}
-
// destroy() should be supported even if it's not spawner.
if (getState() == State.STARTED) {
fProcess.destroy();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
index fa3a0d64d85..33bb3e2fe39 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
@@ -654,6 +654,12 @@ public abstract class AbstractMIControl extends AbstractDsfService
break;
}
}
+ // Must close the stream here to avoid leaking
+ // Bug 345164 and Bug 339379
+ try {
+ if (fOutputStream != null) fOutputStream.close();
+ } catch (IOException e) {
+ }
}
}
@@ -715,6 +721,13 @@ public abstract class AbstractMIControl extends AbstractDsfService
} catch (RejectedExecutionException e) {
// Dispatch thread is down.
}
+ // Must close the stream here to avoid leaking and
+ // to give enough time to read all the data
+ // Bug 345164 and Bug 339379
+ try {
+ fInputStream.close();
+ } catch (IOException e) {
+ }
}
private MIResult findResultRecord(MIResult[] results, String variable) {
@@ -1031,7 +1044,12 @@ public abstract class AbstractMIControl extends AbstractDsfService
} catch (RejectedExecutionException e) {
// Dispatch thread is down.
}
- // The backend service will close the stream
+ // Must close the stream here to avoid leaking
+ // Bug 345164 and Bug 339379
+ try {
+ fErrorStream.close();
+ } catch (IOException e) {
+ }
}
}

Back to the top