/[classpath]/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
ViewVC logotype

Diff of /classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mark, Wed Aug 24 22:57:07 2005 UTC revision 1.4 by keiths, Thu Aug 25 22:09:49 2005 UTC
# Line 40  exception statement from your version. * Line 40  exception statement from your version. *
40  package gnu.classpath.jdwp.processor;  package gnu.classpath.jdwp.processor;
41    
42  import gnu.classpath.jdwp.VMFrame;  import gnu.classpath.jdwp.VMFrame;
 import gnu.classpath.jdwp.IVirtualMachine;  
 import gnu.classpath.jdwp.Jdwp;  
43  import gnu.classpath.jdwp.JdwpConstants;  import gnu.classpath.jdwp.JdwpConstants;
44  import gnu.classpath.jdwp.exception.InvalidObjectException;  import gnu.classpath.jdwp.exception.InvalidObjectException;
45  import gnu.classpath.jdwp.exception.JdwpException;  import gnu.classpath.jdwp.exception.JdwpException;
46  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
47  import gnu.classpath.jdwp.exception.NotImplementedException;  import gnu.classpath.jdwp.exception.NotImplementedException;
 import gnu.classpath.jdwp.id.IdManager;  
48  import gnu.classpath.jdwp.id.ObjectId;  import gnu.classpath.jdwp.id.ObjectId;
49  import gnu.classpath.jdwp.id.ThreadId;  import gnu.classpath.jdwp.id.ThreadId;
50  import gnu.classpath.jdwp.util.JdwpString;  import gnu.classpath.jdwp.util.JdwpString;
# Line 63  import java.util.ArrayList; Line 60  import java.util.ArrayList;
60   *   *
61   * @author Aaron Luchko <aluchko@redhat.com>   * @author Aaron Luchko <aluchko@redhat.com>
62   */   */
63  public class ThreadReferenceCommandSet implements CommandSet  public class ThreadReferenceCommandSet
64      extends CommandSet
65  {  {
   // Our hook into the jvm  
   private final IVirtualMachine vm = Jdwp.getIVirtualMachine();  
   
   // Manages all the different ids that are assigned by jdwp  
   private final IdManager idMan = Jdwp.getIdManager();  
   
66    public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)    public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
67        throws JdwpException        throws JdwpException
68    {    {
# Line 131  public class ThreadReferenceCommandSet i Line 123  public class ThreadReferenceCommandSet i
123    private void executeName(ByteBuffer bb, DataOutputStream os)    private void executeName(ByteBuffer bb, DataOutputStream os)
124        throws JdwpException, IOException        throws JdwpException, IOException
125    {    {
126      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
127      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
128      JdwpString.writeString(os, thread.getName());      JdwpString.writeString(os, thread.getName());
129    }    }
# Line 139  public class ThreadReferenceCommandSet i Line 131  public class ThreadReferenceCommandSet i
131    private void executeSuspend(ByteBuffer bb, DataOutputStream os)    private void executeSuspend(ByteBuffer bb, DataOutputStream os)
132        throws JdwpException, IOException        throws JdwpException, IOException
133    {    {
134      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
135      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
136      vm.suspendThread(thread);      vm.suspendThread(thread);
137    }    }
# Line 147  public class ThreadReferenceCommandSet i Line 139  public class ThreadReferenceCommandSet i
139    private void executeResume(ByteBuffer bb, DataOutputStream os)    private void executeResume(ByteBuffer bb, DataOutputStream os)
140        throws JdwpException, IOException        throws JdwpException, IOException
141    {    {
142      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
143      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
144      vm.suspendThread(thread);      vm.suspendThread(thread);
145    }    }
# Line 155  public class ThreadReferenceCommandSet i Line 147  public class ThreadReferenceCommandSet i
147    private void executeStatus(ByteBuffer bb, DataOutputStream os)    private void executeStatus(ByteBuffer bb, DataOutputStream os)
148        throws InvalidObjectException, IOException        throws InvalidObjectException, IOException
149    {    {
150      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
151      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
152      int threadStatus = vm.getThreadStatus(thread);      int threadStatus = vm.getThreadStatus(thread);
153      // There's only one possible SuspendStatus...      // There's only one possible SuspendStatus...
154      int suspendStatus = JdwpConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED;      int suspendStatus = JdwpConstants.SuspendStatus.SUSPENDED;
155    
156      os.writeInt(threadStatus);      os.writeInt(threadStatus);
157      os.writeInt(suspendStatus);      os.writeInt(suspendStatus);
# Line 168  public class ThreadReferenceCommandSet i Line 160  public class ThreadReferenceCommandSet i
160    private void executeThreadGroup(ByteBuffer bb, DataOutputStream os)    private void executeThreadGroup(ByteBuffer bb, DataOutputStream os)
161        throws InvalidObjectException, IOException        throws InvalidObjectException, IOException
162    {    {
163      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
164      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
165      ThreadGroup group = thread.getThreadGroup();      ThreadGroup group = thread.getThreadGroup();
166      ObjectId groupId = idMan.getId(group);      ObjectId groupId = idMan.getObjectId(group);
167      groupId.write(os);      groupId.write(os);
168    }    }
169    
170    private void executeFrames(ByteBuffer bb, DataOutputStream os)    private void executeFrames(ByteBuffer bb, DataOutputStream os)
171        throws JdwpException, IOException        throws JdwpException, IOException
172    {    {
173      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
174      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
175      int startFrame = bb.getInt();      int startFrame = bb.getInt();
176      int length = bb.getInt();      int length = bb.getInt();
# Line 197  public class ThreadReferenceCommandSet i Line 189  public class ThreadReferenceCommandSet i
189    private void executeFrameCount(ByteBuffer bb, DataOutputStream os)    private void executeFrameCount(ByteBuffer bb, DataOutputStream os)
190        throws JdwpException, IOException        throws JdwpException, IOException
191    {    {
192      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
193      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
194    
195      int frameCount = vm.getFrameCount(thread);      int frameCount = vm.getFrameCount(thread);
# Line 226  public class ThreadReferenceCommandSet i Line 218  public class ThreadReferenceCommandSet i
218    private void executeStop(ByteBuffer bb, DataOutputStream os)    private void executeStop(ByteBuffer bb, DataOutputStream os)
219        throws JdwpException, IOException        throws JdwpException, IOException
220    {    {
221      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
222      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
223      ObjectId exception = idMan.readId(bb);      ObjectId exception = idMan.readObjectId(bb);
224      vm.stopThread(thread, (Exception) exception.getObject());      vm.stopThread(thread, (Exception) exception.getObject());
225    }    }
226    
227    private void executeInterrupt(ByteBuffer bb, DataOutputStream os)    private void executeInterrupt(ByteBuffer bb, DataOutputStream os)
228        throws JdwpException, IOException        throws JdwpException, IOException
229    {    {
230      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
231      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
232      thread.interrupt();      thread.interrupt();
233    }    }
# Line 243  public class ThreadReferenceCommandSet i Line 235  public class ThreadReferenceCommandSet i
235    private void executeSuspendCount(ByteBuffer bb, DataOutputStream os)    private void executeSuspendCount(ByteBuffer bb, DataOutputStream os)
236        throws JdwpException, IOException        throws JdwpException, IOException
237    {    {
238      ThreadId tid = (ThreadId) idMan.readId(bb);      ThreadId tid = (ThreadId) idMan.readObjectId(bb);
239      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
240      int suspendCount = vm.getSuspendCount(thread);      int suspendCount = vm.getSuspendCount(thread);
241      os.writeInt(suspendCount);      os.writeInt(suspendCount);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26