Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Do not reselect the stackframe if already set

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog	10 Oct 2002 15:18:23 -0000	1.1
+++ ChangeLog	10 Oct 2002 22:03:49 -0000
@@ -1,3 +1,23 @@
 2002-10-10 Alain Magloire
 
+	The Eclipse/UI/Debug framewok is being very repetive
+	and each command can be ask 2, 3 times.  So we'll try
+	to make certain commands smarter by not reissuing them
+	to gdb if the state is the same.  We do this when
+	selecting the thread and when selecting the stackframe.
+	
+	The other problem is that Eclipse/UI/Debug is calling
+	ICDISession.terminate() twice, this is catch by looking
+	at isTerminated().
+
+	* cdi/CThread.java (setCurrentStackFrame): Make it smarter
+	to not reselect the stack level if it is already at that
+	level.
+
+	* MISession.java (isTerminated): Declare a flag that will
+	hold the state.
+	(terminate): Check if it was call already.
+
+2002-10-10 Alain Magloire
+
 	* SourceManager.java:  Implement getInstructions().
Index: src/org/eclipse/cdt/debug/mi/core/MISession.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java,v
retrieving revision 1.34
diff -u -r1.34 MISession.java
--- src/org/eclipse/cdt/debug/mi/core/MISession.java	9 Oct 2002 19:54:27 -0000	1.34
+++ src/org/eclipse/cdt/debug/mi/core/MISession.java	10 Oct 2002 22:03:49 -0000
@@ -47,6 +47,7 @@
 	 */
 	public static long REQUEST_TIMEOUT = 10000; // 10 * 1000 (~ 10 secs);
 
+	boolean terminated;
 
 	// hold the type of the session(post-mortem, attach etc ..)
 	int sessionType;
@@ -285,7 +286,7 @@
 	 * Check if the gdb session is terminated.
 	 */
 	public boolean isTerminated() {
-		return (!txThread.isAlive() || !rxThread.isAlive());
+		return terminated;
 	}
 	
 	/**
@@ -293,9 +294,16 @@
 	 */
 	public void terminate() {
 
+		// Sanity check.
+		if (isTerminated()) {
+			return;
+		}
+		
+		terminated = true;
+		
 		// Destroy any MI Inferior(Process) and streams.
 		inferior.destroy();
-
+		
 		// Tell the observers that the session
 		// is finish, but we can not use the Event Thread.
 		// The Event Thread is being kill below.
Index: src/org/eclipse/cdt/debug/mi/core/RxThread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java,v
retrieving revision 1.30
diff -u -r1.30 RxThread.java
--- src/org/eclipse/cdt/debug/mi/core/RxThread.java	9 Oct 2002 19:54:39 -0000	1.30
+++ src/org/eclipse/cdt/debug/mi/core/RxThread.java	10 Oct 2002 22:03:50 -0000
@@ -68,7 +68,8 @@
 		try {
 			String line;
 			while ((line = reader.readLine()) != null) {
-//MIPlugin.getDefault().debugLog(line);
+//String text = (line.length() > 500) ? line.substring(0, 500) : line;
+//MIPlugin.getDefault().debugLog(text);
 				processMIOutput(line + "\n");
 			}
 		} catch (IOException e) {
Index: src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java,v
retrieving revision 1.15
diff -u -r1.15 CThread.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java	9 Oct 2002 14:08:42 -0000	1.15
+++ src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java	10 Oct 2002 22:03:50 -0000
@@ -99,6 +99,14 @@
 		if (stackframe != null) {
 			frameNum = stackframe.getLevel();
 		}
+		
+		// Check to see if we are already at this level
+		StackFrame current = getCurrentStackFrame();
+		if (current.getLevel() == frameNum) {
+			// noop
+			return;
+		}
+		
 		MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum);
 		try {
 			// Set ourself as the current thread first.



Back to the top