Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] MI/CTarget.java

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.56
diff -u -r1.56 ChangeLog
--- ChangeLog	9 Jan 2003 19:13:19 -0000	1.56
+++ ChangeLog	9 Jan 2003 20:53:41 -0000
@@ -1,5 +1,14 @@
 2003-01-09 Alain Magloire
 
+	* src/.../mi/core/cdi/model/CTarget.java (setCurrentThread): takes
+	a new argument to decide if the events should be fired.
+	* src/.../mi/core/cdi/model/CThread.java (getStackFrameCount): use
+	the setCurrentThread() with events updates disable
+	(getStackFrames): Ditto.
+	(updateState): Wrong subscript in the loop.
+
+2003-01-09 Alain Magloire
+
 	Generate CreatedEvent's for Variable, Argument, Expression, Memory, Thread
 	objects when they are created.  This makes it consistent with the generated
 	DestroyedEvent's.
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/CTarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/CTarget.java,v
retrieving revision 1.2
diff -u -r1.2 CTarget.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/CTarget.java	9 Jan 2003 19:13:11 -0000	1.2
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/CTarget.java	9 Jan 2003 20:53:41 -0000
@@ -84,14 +84,18 @@
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread)
 	 */
 	public void setCurrentThread(ICDIThread cthread) throws CDIException {
+		setCurrentThread(cthread, true);
+	}
+	
+	public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException {
 		if (cthread instanceof CThread) {
-			setCurrentThread((CThread)cthread);
+			setCurrentThread((CThread)cthread, doUpdate);
 		}
 	}
 
 	/**
 	 */
-	public void setCurrentThread(CThread cthread) throws CDIException {
+	public void setCurrentThread(CThread cthread, boolean doUpdate) throws CDIException {
 		session.setCurrentTarget(this);
 		int id = cthread.getId();
 		// No need to set thread id 0, it is a dummy thread.
@@ -117,8 +121,10 @@
 			// Resetting threads may change the value of
 			// some variables like Register.  Send an update
 			// To generate changeEvents.
-			RegisterManager regMgr = session.getRegisterManager();
-			regMgr.update();
+			if (doUpdate) {
+				RegisterManager regMgr = session.getRegisterManager();
+				regMgr.update();
+			}
 		}
 
 		// We should be allright now.
@@ -126,7 +132,7 @@
 			// thread is gone.  Generate a Thread destroyed.
 			MISession mi = session.getMISession();
 			mi.fireEvent(new MIThreadExitEvent(id));
-			throw new CDIException("Thread destroyed");
+			throw new CDIException("Can not swith to thread " + id);
 		}
 	}
 
@@ -151,7 +157,7 @@
 			for (int i = 0; i < newThreads.length; i++) {
 				boolean found = false;
 				for (int j = 0; oldThreads != null && j < oldThreads.length; j++) {
-					if (newThreads[j].getId() == ((CThread)oldThreads[i]).getId()) {
+					if (newThreads[i].getId() == ((CThread)oldThreads[j]).getId()) {
 						found = true;
 						break;
 					}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/CThread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/CThread.java,v
retrieving revision 1.1
diff -u -r1.1 CThread.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/CThread.java	9 Jan 2003 03:46:22 -0000	1.1
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/CThread.java	9 Jan 2003 20:53:41 -0000
@@ -67,7 +67,7 @@
 		MIStackListFrames frames = factory.createMIStackListFrames();
 		try {
 			ICDIThread oldThread = getCTarget().getCurrentThread();
-			getCTarget().setCurrentThread(this);
+			getCTarget().setCurrentThread(this, false);
 			mi.postCommand(frames);
 			MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
 			if (info == null) {
@@ -78,7 +78,7 @@
 			for (int i = 0; i < stack.length; i++) {
 				stack[i] = new StackFrame(this, miFrames[i]);
 			}
-			getCTarget().setCurrentThread(oldThread);
+			getCTarget().setCurrentThread(oldThread, false);
 			return stack;
 		} catch (MIException e) {
 			//throw new CDIException(e.getMessage());
@@ -100,13 +100,13 @@
 		MIStackInfoDepth depth = factory.createMIStackInfoDepth();
 		try {
 			ICDIThread oldThread = getCTarget().getCurrentThread();
-			getCTarget().setCurrentThread(this);
+			getCTarget().setCurrentThread(this, false);
 			mi.postCommand(depth);
 			MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
 			if (info == null) {
 				throw new CDIException("No answer");
 			}
-			getCTarget().setCurrentThread(oldThread);
+			getCTarget().setCurrentThread(oldThread, false);
 			return info.getDepth();
 		} catch (MIException e) {
 			throw new MI2CDIException(e);
@@ -126,7 +126,7 @@
 		MIStackListFrames frames = factory.createMIStackListFrames(low, high);
 		try {
 			ICDIThread oldThread = getCTarget().getCurrentThread();
-			getCTarget().setCurrentThread(this);
+			getCTarget().setCurrentThread(this, false);
 			mi.postCommand(frames);
 			MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
 			if (info == null) {
@@ -137,7 +137,7 @@
 			for (int i = 0; i < stack.length; i++) {
 				stack[i] = new StackFrame(this, miFrames[i]);
 			}
-			getCTarget().setCurrentThread(oldThread);
+			getCTarget().setCurrentThread(oldThread, false);
 			return stack;
 		} catch (MIException e) {
 			//throw new CDIException(e.getMessage());



Back to the top