1 package jde.debugger.command;
4 import com.sun.jdi.IncompatibleThreadStateException;
5 import com.sun.jdi.ThreadReference;
6 import jde.debugger.Etc;
7 import jde.debugger.JDEException;
8 import jde.debugger.Rep;
9 import jde.debugger.JDE;
14 * Stops the VM and debug the specified thread.
19 * debug_thread threadID
22 * Copyright (c) 2000, 2001, 2003 Paul Kinnucan
24 * @author Raffael Herzog
25 * @author Paul Kinnucan
26 * @version $Revision: 1.3 $
28 public class DebugThread extends DebugProcessCommand {
32 * @exception jde.debugger.JDEException <description>
34 public void doCommand() throws JDEException {
36 if (m_args.size() < 1)
37 throw new JDEException("Insufficient arguments");
39 // find the thread to debug
40 Long uniqueID = Etc.safeGetLong(m_args.remove(0), "thread ID");
42 ThreadReference tRef = (ThreadReference) m_debugger.getStore().get(uniqueID);
46 throw new JDEException("Invalid thread ID or the thread is dead");
49 // suspend the whole vm
50 m_debugger.getVM().suspend();
52 // simulate a step event
54 final String locationRep = Rep.getLocationRep(tRef.frame(0).location());
55 final String lispForm = "(list '"
60 JDE.signal(m_debugger.getProcID(), EVENTSET,
62 Rep.getThreadRep(tRef) + BR + lispForm);
63 m_debugger.signalCommandResult(m_cmdID, null, CMD_OK);
65 catch ( IncompatibleThreadStateException exc ) {
66 // this should never happen...
67 throw new JDEException(exc.toString());
71 public Object clone() {return new DebugThread();}
76 * $Log: DebugThread.java,v $
77 * Revision 1.3 2003/01/15 05:56:26 paulk
78 * Add Petter Mahlen's changes.
80 * Revision 1.2 2001/07/07 04:51:35 paulk
81 * Removed DOS line endings.
83 * Revision 1.1 2001/07/06 02:04:50 paulk
90 // End of DebugThread.java