Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2003-04-29 20:14:28 +0000
committerAlain Magloire2003-04-29 20:14:28 +0000
commit4475c5e697c5a8c91236ed9024897643b32ebac5 (patch)
tree9ed2128f3e0868e96729c7df635783895a033a22
parent2ea902803476ab528e169348cc9072cd586c6ddb (diff)
downloadorg.eclipse.cdt-4475c5e697c5a8c91236ed9024897643b32ebac5.tar.gz
org.eclipse.cdt-4475c5e697c5a8c91236ed9024897643b32ebac5.tar.xz
org.eclipse.cdt-4475c5e697c5a8c91236ed9024897643b32ebac5.zip
Disable command input when terminating.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java
index dd9aef24c50..f2261add0b2 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java
@@ -275,9 +275,6 @@ public class MISession extends Observable {
*/
public synchronized void postCommand(Command cmd, long timeout) throws MIException {
- // TRACING: print the command;
- MIPlugin.getDefault().debugLog(cmd.toString());
-
// Test if we are in a sane state.
if (!txThread.isAlive() || !rxThread.isAlive()) {
throw new MIException("{R,T}xThread terminated");
@@ -288,9 +285,17 @@ public class MISession extends Observable {
// REMINDER: if we support -exec-interrupt
// Let it throught:
// if (cmd instanceof MIExecInterrupt) { }
+ // else
throw new MIException("Target is not suspended");
}
+ if (isTerminated()) {
+ throw new MIException("Session terminated");
+ }
+
+ // TRACING: print the command;
+ MIPlugin.getDefault().debugLog(cmd.toString());
+
txQueue.addCommand(cmd);
// Wait for the response or timedout
@@ -364,11 +369,20 @@ public class MISession extends Observable {
OutputStream outGDB = outChannel;
outChannel = null;
+ // Although we will close the pipe(). It is cleaner
+ // to give a chance to gdb to cleanup.
// send the exit(-gdb-exit).
- try {
- MIGDBExit exit = factory.createMIGDBExit();
- postCommand(exit);
- } catch (MIException e) {
+ MIGDBExit exit = factory.createMIGDBExit();
+ txQueue.addCommand(exit);
+
+ // Wait for the response
+ synchronized (exit) {
+ // RxThread will set the MIOutput on the cmd
+ // when the response arrive.
+ try {
+ exit.wait(2000);
+ } catch (InterruptedException e) {
+ }
}
// Make sure gdb is killed.
@@ -446,14 +460,8 @@ public class MISession extends Observable {
} catch (InterruptedException e) {
}
- // Flush the queue.
- queue.clearItems();
-
- // Tell the observers that the session
- // is finish, but we can not use the Event Thread.
- // The Event Thread was kill above.
+ // Tell the observers that the session is terminated
notifyObservers(new MIGDBExitEvent(0));
-
}
/**

Back to the top