Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Patch for 69711

This is a patch for 69711, which adds support for thread names in the CDT debug view. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=69711 for more information.

/Stefan

Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java,v
retrieving revision 1.4
diff -u -r1.4 Target.java
--- cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java	30 Jun 2004 02:21:28 -0000	1.4
+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java	9 Jul 2004 14:55:10 -0000
@@ -256,16 +256,25 @@
 			mi.postCommand(tids);
 			MIInfoThreadsInfo info = tids.getMIInfoThreadsInfo();
 			int [] ids;
+			String[] names;
 			if (info == null) {
 				ids = new int[0];
+				names = new String[0];
 			} else {
 				ids = info.getThreadIds();
+				names = info.getThreadNames();
 			}
 			if (ids != null && ids.length > 0) {
 				cthreads = new Thread[ids.length];
 				// Ok that means it is a multiThreaded.
-				for (int i = 0; i < ids.length; i++) {
-					cthreads[i] = new Thread(this, ids[i]);
+				if (names != null && names.length == ids.length) {
+					for (int i = 0; i < ids.length; i++) {
+						cthreads[i] = new Thread(this, ids[i], names[i]);
+					}
+				} else {
+					for (int i = 0; i < ids.length; i++) {
+						cthreads[i] = new Thread(this, ids[i]);
+					}
 				}
 			} else {
 				// Provide a dummy.
Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java,v
retrieving revision 1.3
diff -u -r1.3 Thread.java
--- cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java	25 Jun 2004 14:46:47 -0000	1.3
+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java	9 Jul 2004 14:55:10 -0000
@@ -41,6 +41,7 @@
 
 	static ICDIStackFrame[] noStack = new ICDIStackFrame[0];
 	int id;
+	String name;
 	ICDIStackFrame currentFrame;
 	List currentFrames;
 	int stackdepth = 0;
@@ -48,8 +49,13 @@
 	final static int STACKFRAME_DEFAULT_DEPTH = 200;
 
 	public Thread(ICDITarget target, int threadId) {
+		this(target, threadId, null);
+	}
+
+	public Thread(ICDITarget target, int threadId, String threadName) {
 		super(target);
 		id = threadId;
+		name = threadName;
 	}
 
 	public int getId() {
@@ -63,7 +69,11 @@
 	}
 
 	public String toString() {
-		return Integer.toString(id);
+		String str = Integer.toString(id);
+		if (name != null) {
+			str += " " + name;
+		}
+		return str;
 	}
 
 	public void updateState() {
Index: mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java,v
retrieving revision 1.2
diff -u -r1.2 MIInfoThreadsInfo.java
--- mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java	25 Jun 2004 14:46:48 -0000	1.2
+++ mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java	9 Jul 2004 14:55:10 -0000
@@ -35,6 +35,10 @@
 		return threadIds;
 	}
 
+	public String[] getThreadNames() {
+		return null;
+	}
+
 	public int getCurrentThread() {
 		return currentThreadId;
 	}

Back to the top