1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

The exit value is save in case the gdb was terminated before

the value was fetch.  setTerminated(boolean) only
fire an event when destroy is called.
This commit is contained in:
Alain Magloire 2002-10-05 19:49:21 +00:00
parent b65d77fc75
commit 1d294c4344

View file

@ -32,6 +32,7 @@ public class MIInferior extends Process {
boolean attached = false; boolean attached = false;
int exitCode = 0;
int state = 0; int state = 0;
MISession session; MISession session;
@ -139,12 +140,12 @@ public class MIInferior extends Process {
try { try {
session.postCommand(code); session.postCommand(code);
MIGDBShowExitCodeInfo info = code.getMIGDBShowExitCodeInfo(); MIGDBShowExitCodeInfo info = code.getMIGDBShowExitCodeInfo();
return info.getCode(); exitCode = info.getCode();
} catch (MIException e) { } catch (MIException e) {
// no rethrown. // no rethrown.
} }
} }
return 0; return exitCode;
} }
throw new IllegalThreadStateException(); throw new IllegalThreadStateException();
} }
@ -161,7 +162,7 @@ public class MIInferior extends Process {
interrupt(); interrupt();
session.postCommand(abort); session.postCommand(abort);
MIInfo info = abort.getMIInfo(); MIInfo info = abort.getMIInfo();
setTerminated(); setTerminated(true);
} catch (MIException e) { } catch (MIException e) {
} }
} }
@ -219,6 +220,10 @@ public class MIInferior extends Process {
} }
public synchronized void setTerminated() { public synchronized void setTerminated() {
setTerminated(false);
}
synchronized void setTerminated(boolean fireEvent) {
state = TERMINATED; state = TERMINATED;
// Close the streams. // Close the streams.
try { try {
@ -258,7 +263,9 @@ public class MIInferior extends Process {
out = null; out = null;
} }
} }
session.fireEvent(new MIInferiorExitEvent()); if (fireEvent) {
session.fireEvent(new MIInferiorExitEvent());
}
notifyAll(); notifyAll();
} }