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

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

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

revision 1.3 by aluchko, Sat Aug 13 01:00:39 2005 UTC revision 1.4 by keiths, Thu Aug 25 22:09:49 2005 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39    
40  package gnu.classpath.jdwp.processor;  package gnu.classpath.jdwp.processor;
41    
 import gnu.classpath.jdwp.IVirtualMachine;  
 import gnu.classpath.jdwp.Jdwp;  
42  import gnu.classpath.jdwp.JdwpConstants;  import gnu.classpath.jdwp.JdwpConstants;
43  import gnu.classpath.jdwp.exception.InvalidFieldException;  import gnu.classpath.jdwp.exception.InvalidFieldException;
44  import gnu.classpath.jdwp.exception.JdwpException;  import gnu.classpath.jdwp.exception.JdwpException;
45  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
46  import gnu.classpath.jdwp.exception.NotImplementedException;  import gnu.classpath.jdwp.exception.NotImplementedException;
 import gnu.classpath.jdwp.id.IdManager;  
47  import gnu.classpath.jdwp.id.ObjectId;  import gnu.classpath.jdwp.id.ObjectId;
48  import gnu.classpath.jdwp.id.ReferenceTypeId;  import gnu.classpath.jdwp.id.ReferenceTypeId;
49  import gnu.classpath.jdwp.util.Value;  import gnu.classpath.jdwp.util.Value;
# Line 63  import java.nio.ByteBuffer; Line 60  import java.nio.ByteBuffer;
60   *   *
61   * @author Aaron Luchko <aluchko@redhat.com>   * @author Aaron Luchko <aluchko@redhat.com>
62   */   */
63  public class ObjectReferenceCommandSet implements CommandSet  public class ObjectReferenceCommandSet
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 119  public class ObjectReferenceCommandSet i Line 111  public class ObjectReferenceCommandSet i
111    private void executeReferenceType(ByteBuffer bb, DataOutputStream os)    private void executeReferenceType(ByteBuffer bb, DataOutputStream os)
112      throws JdwpException, IOException      throws JdwpException, IOException
113    {    {
114      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
115      Object obj = oid.getObject();      Object obj = oid.getObject();
116      Class clazz = obj.getClass();      Class clazz = obj.getClass();
117      ReferenceTypeId refId = idMan.getReferenceTypeId(clazz);      ReferenceTypeId refId = idMan.getReferenceTypeId(clazz);
# Line 129  public class ObjectReferenceCommandSet i Line 121  public class ObjectReferenceCommandSet i
121    private void executeGetValues(ByteBuffer bb, DataOutputStream os)    private void executeGetValues(ByteBuffer bb, DataOutputStream os)
122      throws JdwpException, IOException      throws JdwpException, IOException
123    {    {
124      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
125      Object obj = oid.getObject();      Object obj = oid.getObject();
126    
127      int numFields = bb.getInt();      int numFields = bb.getInt();
# Line 138  public class ObjectReferenceCommandSet i Line 130  public class ObjectReferenceCommandSet i
130    
131      for (int i = 0; i < numFields; i++)      for (int i = 0; i < numFields; i++)
132        {        {
133          Field field = (Field) idMan.readId(bb).getObject();          Field field = (Field) idMan.readObjectId(bb).getObject();
134          try          try
135            {            {
136              field.setAccessible(true); // Might be a private field              field.setAccessible(true); // Might be a private field
# Line 161  public class ObjectReferenceCommandSet i Line 153  public class ObjectReferenceCommandSet i
153    private void executeSetValues(ByteBuffer bb, DataOutputStream os)    private void executeSetValues(ByteBuffer bb, DataOutputStream os)
154      throws JdwpException, IOException      throws JdwpException, IOException
155    {    {
156      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
157      Object obj = oid.getObject();      Object obj = oid.getObject();
158    
159      int numFields = bb.getInt();      int numFields = bb.getInt();
160    
161      for (int i = 0; i < numFields; i++)      for (int i = 0; i < numFields; i++)
162        {        {
163          Field field = (Field) idMan.readId(bb).getObject();          Field field = (Field) idMan.readObjectId(bb).getObject();
164          Object value = Value.getUntaggedObj(bb, field.getType());          Object value = Value.getUntaggedObj(bb, field.getType());
165          try          try
166            {            {
# Line 201  public class ObjectReferenceCommandSet i Line 193  public class ObjectReferenceCommandSet i
193    private void executeInvokeMethod(ByteBuffer bb, DataOutputStream os)    private void executeInvokeMethod(ByteBuffer bb, DataOutputStream os)
194      throws JdwpException, IOException      throws JdwpException, IOException
195    {    {
196      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
197      Object obj = oid.getObject();      Object obj = oid.getObject();
198    
199      ObjectId tid = idMan.readId(bb);      ObjectId tid = idMan.readObjectId(bb);
200      Thread thread = (Thread) tid.getObject();      Thread thread = (Thread) tid.getObject();
201    
202      ReferenceTypeId rid = idMan.readReferenceTypeId(bb);      ReferenceTypeId rid = idMan.readReferenceTypeId(bb);
203      Class clazz = rid.getType();      Class clazz = rid.getType();
204    
205      ObjectId mid = idMan.readId(bb);      ObjectId mid = idMan.readObjectId(bb);
206      Method method = (Method) mid.getObject();      Method method = (Method) mid.getObject();
207    
208      int args = bb.getInt();      int args = bb.getInt();
# Line 237  public class ObjectReferenceCommandSet i Line 229  public class ObjectReferenceCommandSet i
229      Object value = mr.getReturnedValue();      Object value = mr.getReturnedValue();
230      Exception exception = mr.getThrownException();      Exception exception = mr.getThrownException();
231    
232      ObjectId eId = idMan.getId(exception);      ObjectId eId = idMan.getObjectId(exception);
233      Value.writeTaggedValue(os, value);      Value.writeTaggedValue(os, value);
234      eId.writeTagged(os);      eId.writeTagged(os);
235    }    }
# Line 245  public class ObjectReferenceCommandSet i Line 237  public class ObjectReferenceCommandSet i
237    private void executeDisableCollection(ByteBuffer bb, DataOutputStream os)    private void executeDisableCollection(ByteBuffer bb, DataOutputStream os)
238      throws JdwpException, IOException      throws JdwpException, IOException
239    {    {
240      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
241      oid.disableCollection();      oid.disableCollection();
242    }    }
243    
244    private void executeEnableCollection(ByteBuffer bb, DataOutputStream os)    private void executeEnableCollection(ByteBuffer bb, DataOutputStream os)
245      throws JdwpException, IOException      throws JdwpException, IOException
246    {    {
247      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
248      oid.enableCollection();      oid.enableCollection();
249    }    }
250    
251    private void executeIsCollected(ByteBuffer bb, DataOutputStream os)    private void executeIsCollected(ByteBuffer bb, DataOutputStream os)
252      throws JdwpException, IOException      throws JdwpException, IOException
253    {    {
254      ObjectId oid = idMan.readId(bb);      ObjectId oid = idMan.readObjectId(bb);
255      boolean collected = oid.isCollected();      boolean collected = (oid.getReference().get () == null);
256      os.writeBoolean(collected);      os.writeBoolean(collected);
257    }    }
258  }  }

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