Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] MI catching cli "detach" PR 40330

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.148
diff -u -r1.148 ChangeLog
--- ChangeLog	16 Jul 2003 19:09:21 -0000	1.148
+++ ChangeLog	17 Jul 2003 18:52:47 -0000
@@ -1,3 +1,9 @@
+2003-07-17 Alain Magloire
+
+	Catch the use of cli command "detach" and fire the appropriate events.
+
+	* src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java
+
 2003-07-16 Alain Magloire
 
 	Provide FunctionValue, PointerValue and ArrayValue.
Index: src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java,v
retrieving revision 1.9
diff -u -r1.9 CLIProcessor.java
--- src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java	9 Feb 2003 22:19:07 -0000	1.9
+++ src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java	17 Jul 2003 18:52:47 -0000
@@ -7,6 +7,7 @@
  
 import org.eclipse.cdt.debug.mi.core.command.CLICommand;
 import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
+import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
 import org.eclipse.cdt.debug.mi.core.event.MIEvent;
 import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
 import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
@@ -53,7 +54,13 @@
 			// So the easiest way is to let the top layer handle it. 
 			session.fireEvent(new MIBreakpointChangedEvent(0));
 		} else if (isSettingSignal(operation)) {
+			// We do no know which signal let the upper layer find it.
 			session.fireEvent(new MISignalChangedEvent(""));
+		} else if (isDetach(operation)) {
+			// if it was a "detach" command change the state.
+			session.getMIInferior().setDisconnected();
+			MIEvent event = new MIDetachedEvent(cmd.getToken());
+			session.fireEvent(event);
 		}
 	}
 
@@ -143,5 +150,14 @@
 		}
 		return isChange;
 	}
+
+	/**
+	 * @param operation
+	 * @return
+	 */
+	boolean isDetach(String operation) {
+		return (operation.startsWith("det")  && "detach".indexOf(operation) != -1);
+	}
+
 
 }



Back to the top