[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] PR 38964 for MI code
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.154
diff -u -r1.154 ChangeLog
--- ChangeLog 7 Aug 2003 03:29:35 -0000 1.154
+++ ChangeLog 7 Aug 2003 15:04:41 -0000
@@ -1,3 +1,14 @@
+2003-08-07 Alain Magloire
+
+ PR 38964.
+
+ * src/org/eclipse/cdt/debug/mi/core/MIInferior.java:
+ The method interrupted was synchronized and so was the
+ setSuspended(). Now do a notify when the status change.
+ Throw an exception if the interrupt() failed.
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java:
+ Do not check for running.
+
2003-08-06 Alain Magloire
Dealing with casting: Casting a field of a structure did not
Index: src/org/eclipse/cdt/debug/mi/core/MIInferior.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIInferior.java,v
retrieving revision 1.30
diff -u -r1.30 MIInferior.java
--- src/org/eclipse/cdt/debug/mi/core/MIInferior.java 10 Jul 2003 19:24:55 -0000 1.30
+++ src/org/eclipse/cdt/debug/mi/core/MIInferior.java 7 Aug 2003 15:04:41 -0000
@@ -37,7 +37,7 @@
OutputStream out;
InputStream in;
-
+
PipedOutputStream inPiped;
PipedInputStream err;
@@ -46,7 +46,6 @@
int inferiorPid;
-
MIInferior(MISession mi, PTY p) {
session = mi;
pty = p;
@@ -111,11 +110,9 @@
/**
* @see java.lang.Process#waitFor()
*/
- public int waitFor() throws InterruptedException {
- if (!isTerminated()) {
- synchronized (this) {
- wait();
- }
+ public synchronized int waitFor() throws InterruptedException {
+ while (state != TERMINATED) {
+ wait();
}
return exitValue();
}
@@ -152,8 +149,7 @@
// - For Program session:
// if the inferior was not terminated.
// - For PostMortem(Core): noop
- if ((session.isAttachSession() && isConnected()) ||
- (session.isProgramSession() && !isTerminated())) {
+ if ((session.isAttachSession() && isConnected()) || (session.isProgramSession() && !isTerminated())) {
CommandFactory factory = session.getCommandFactory();
MIExecAbort abort = factory.createMIExecAbort();
@@ -168,28 +164,32 @@
}
}
- public void interrupt() throws MIException {
+ public synchronized void interrupt() throws MIException {
Process gdb = session.getGDBProcess();
if (gdb instanceof Spawner) {
- Spawner gdbSpawner = (Spawner)gdb;
+ Spawner gdbSpawner = (Spawner) gdb;
gdbSpawner.interrupt();
// Allow (5 secs) for the interrupt to propagate.
- for (int i = 0; isRunning() && i < 5; i++) {
+ for (int i = 0;(state == RUNNING) && i < 5; i++) {
try {
- java.lang.Thread.sleep(1000);
+ wait(1000);
} catch (InterruptedException e) {
}
}
- if (isRunning() && inferiorPid > 0) {
+ if ((state == RUNNING) && inferiorPid > 0) {
// lets try something else.
gdbSpawner.raise(inferiorPid, gdbSpawner.INT);
- }
- for (int i = 0; isRunning() && i < 5; i++) {
- try {
- java.lang.Thread.sleep(1000);
- } catch (InterruptedException e) {
+ for (int i = 0;(state == RUNNING) && i < 5; i++) {
+ try {
+ wait(1000);
+ } catch (InterruptedException e) {
+ }
}
}
+ // If we've failed throw an exception up.
+ if (state == RUNNING) {
+ throw new MIException("Failed to interrupt");
+ }
} else {
// Try the exec-interrupt; this will be for "gdb --async"
// CommandFactory factory = session.getCommandFactory();
@@ -229,10 +229,12 @@
public synchronized void setSuspended() {
state = SUSPENDED;
+ notifyAll();
}
public synchronized void setRunning() {
state = RUNNING;
+ notifyAll();
}
public synchronized void setTerminated() {
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java,v
retrieving revision 1.11
diff -u -r1.11 Target.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java 22 Apr 2003 20:56:09 -0000 1.11
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java 7 Aug 2003 15:04:42 -0000
@@ -486,9 +486,6 @@
MISession mi = session.getMISession();
try {
mi.getMIInferior().interrupt();
- if (isRunning()) {
- throw new CDIException("Unable to suspend target");
- }
} catch (MIException e) {
throw new MI2CDIException(e);
}