From d01737efb75dda83984a6ce3fa344b45c0600146 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 9 Jul 2004 17:54:39 +0000 Subject: [PATCH] 2004-07-09 Alain Magloire Patch from Stefan Bylund for PR 69711 Added support for thread name. * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java * mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 9 +++++++++ .../eclipse/cdt/debug/mi/core/cdi/model/Target.java | 13 +++++++++++-- .../eclipse/cdt/debug/mi/core/cdi/model/Thread.java | 12 +++++++++++- .../cdt/debug/mi/core/output/MIInfoThreadsInfo.java | 4 ++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index 2382095ac98..e50e11aad75 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,12 @@ +2004-07-09 Alain Magloire + + Patch from Stefan Bylund for PR 69711 + Added support for thread name. + + * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java + * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java + * mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java + 2004-07-02 Mikhail Khodjaiants Fix for bug 68934: Debug into dll doesn't work. diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java index 12754f3795d..38cfc3b3b3c 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java @@ -256,16 +256,25 @@ public class Target implements ICDITarget { 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. diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java index b2d0b8d01a2..9b460055c6a 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java @@ -41,6 +41,7 @@ public class Thread extends CObject implements ICDIThread { static ICDIStackFrame[] noStack = new ICDIStackFrame[0]; int id; + String name; ICDIStackFrame currentFrame; List currentFrames; int stackdepth = 0; @@ -48,8 +49,13 @@ public class Thread extends CObject implements ICDIThread { 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 class Thread extends CObject implements ICDIThread { } public String toString() { - return Integer.toString(id); + String str = Integer.toString(id); + if (name != null) { + str += " " + name; + } + return str; } public void updateState() { diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java index 010e844510f..b15950c1dff 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoThreadsInfo.java @@ -35,6 +35,10 @@ public class MIInfoThreadsInfo extends MIInfo { return threadIds; } + public String[] getThreadNames() { + return null; + } + public int getCurrentThread() { return currentThreadId; }