1 package jde.debugger.command;
3 import java.util.Iterator;
5 import com.sun.jdi.InvalidTypeException;
6 import com.sun.jdi.ObjectReference;
7 import com.sun.jdi.ThreadGroupReference;
8 import com.sun.jdi.ThreadReference;
9 import jde.debugger.Etc;
10 import jde.debugger.JDEException;
14 * 'kill thread' command. Kill a thread with a given exception object.
19 * kill_thread threadID exceptionObjectID
24 * <li> threadID can be retrieved using the get_threads command
25 * <li> exceptionObjectID is the object id of a Throwable object. It
26 * can be created using the 'evaluate' command, or an existing throwable
30 * @author Paul Kinnucan
31 * @version $Revision: 1.2 $
32 * @copyright Copyright (c) 2000, 2001, 2003 Paul Kinnucan
35 public class KillThread extends DebugProcessCommand {
39 * @exception jde.debugger.JDEException <description>
41 public void doCommand() throws JDEException {
42 if (m_args.size() < 2)
43 throw new JDEException("Insufficient arguments");
45 Long uniqueID = Etc.safeGetLong(m_args.remove(0), "thread ID");
47 ObjectReference oRef = m_debugger.getStore().get(uniqueID);
49 throw new JDEException("No such thread exists");
50 } else if (!(oRef instanceof ThreadReference)) {
51 throw new JDEException("The ID doesn't correspond to a thread");
53 ThreadReference tRef = (ThreadReference) oRef;
55 uniqueID = Etc.safeGetLong(m_args.remove(0), "thread ID");
57 oRef = m_debugger.getStore().get(uniqueID);
59 throw new JDEException("No such thread exists");
64 } catch (InvalidTypeException ex) {
65 throw new JDEException("Object ID doesn't correspond to a Throwable object");
67 m_debugger.signalCommandResult(m_cmdID, null, CMD_OK);
70 public Object clone() {return new KillThread();}
75 * $Log: KillThread.java,v $
76 * Revision 1.2 2003/01/15 05:56:26 paulk
77 * Add Petter Mahlen's changes.
79 * Revision 1.1 2001/03/24 13:35:25 paulk
85 // End of KillThread.java