Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] GDB/MI wait when sending SIGINT

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.113
diff -u -r1.113 ChangeLog
--- ChangeLog	28 Mar 2003 23:05:44 -0000	1.113
+++ ChangeLog	2 Apr 2003 21:15:09 -0000
@@ -1,3 +1,9 @@
+2003-04-02 Alain Magloire
+
+	* src/org/eclipse/cdt/debug/mi/core/cdt/model/Target.java:
+	suspend() sync for at least < 10 seconds to allow the gdb to
+	suspend via SIGINT the program.
+
 2003-03-28 Mikhail Khodjaiants
 	Added time stamp to the trace messages.
 	* MIPlugin.java

Index: 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.6
diff -u -r1.6 Target.java
--- Target.java	12 Feb 2003 19:41:18 -0000	1.6
+++ Target.java	2 Apr 2003 21:14:50 -0000
@@ -474,10 +474,20 @@
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend()
 	 */
 	public void suspend() throws CDIException {
-		// send a noop to see if we get an aswer.
+		// Send the interrupt an sync for 10 seconds.
+		// for an answer.  The waiting time is arbitrary.
 		MISession mi = session.getMISession();
 		try {
 			mi.getMIInferior().interrupt();
+			for (int i = 0; isRunning() && i < 5; i++) {
+				try {
+					java.lang.Thread.sleep(2000);
+				} catch (InterruptedException e) {
+				}
+			}
+			if (isRunning()) {
+				throw new CDIException("Failed to suspend");
+			}
 		} catch (MIException e) {
 			throw new MI2CDIException(e);
 		}



Back to the top