1 package jde.debugger.command;
3 import jde.debugger.JDEException;
4 import com.sun.jdi.ThreadGroupReference;
5 import jde.debugger.Rep;
6 import java.util.Iterator;
11 * List all threads. 'get_threads' command.
21 * (jde-dbo-command-result cmd_id {@link #doCommand thread-info})
26 * <li> There are a couple of quirks regarding the reporting
29 * <li> Quirk 1: Due to a bug in ThreadReference.isAtBreakpoint(),
30 * a thread will report a breakpoint at a location
31 * even if a threadFilter has been applied for the
32 * thread. ie, if test.Test.java:41 is your
33 * breakpoint, and you've applied a threadfilter
34 * saying you DON'T want an event if the thread ==
35 * Thread-A, and you somehow suspend Thread-A at
36 * exactly that line, and do a 'get_threads';
37 * Thread-A will report to be suspended on a
38 * breakpoint, although ordinarily it would have
41 * <li> Quirk 2: There seems to be no way of reporting the
42 * status if the user does a
43 * Thread.suspend(). Well, it's deprecated
48 * @author Paul Kinnucan
49 * @version $Revision: 1.2 $
50 * @copyright Copyright (c) 2000, 2001, 2003 Paul Kinnucan
53 public class GetThreads extends DebugProcessCommand {
56 * Returns a representation of all the threads and threadgroups
57 * in the VM. For example:
73 * (list "ThreadGroup" <tgID> "ThreadGroup-1"
75 * (list "Thread" <tID> "Thread-5" ...))
77 * (list "ThreadGroup" <tgID> "ThreadGroup-2"
79 * (list "Thread" <tID> "Thread-4"))
81 * (list "ThreadGroup" <tgID> "ThreadGroup-3"
84 * (list "Thread" <tID> "Thread-1" ...)))
85 * (list "ThreadGroup" <tgID> "ThreadGroup-4"
88 * (list "Thread" <tID> "Thread-2" ...)
89 * (list "Thread" <tID> "Thread-3" ...)))))))
90 * (list "ThreadGroup" <tgID> "ThreadGroup-5"
93 * (list "Thread" <tID> "Thread-6" ...))))
97 * (list [{@link Rep#getThreadGroupRep top-level thread group}]*)
100 * @exception jde.debugger.JDEException <description>
102 public void doCommand() throws JDEException {
104 List l = m_debugger.getVM().topLevelThreadGroups();
105 Iterator it = l.iterator();
106 StringBuffer result = new StringBuffer("(list ");
108 while (it.hasNext()) {
109 // XXX may have to populate the ObjectStore here.
112 result.append(Rep.getThreadGroupRep((ThreadGroupReference)it.next()));
117 m_debugger.signalCommandResult(m_cmdID, result.toString(), CMD_OK, NOQUOTE);
122 public Object clone() {return new GetThreads();}
127 * $Log: GetThreads.java,v $
128 * Revision 1.2 2003/01/15 05:56:26 paulk
129 * Add Petter Mahlen's changes.
131 * Revision 1.1 2001/03/24 13:35:25 paulk
137 // End of GetThreads.java