40 |
|
|
41 |
package gnu.classpath.jdwp.processor; |
package gnu.classpath.jdwp.processor; |
42 |
|
|
|
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.InvalidFieldException; |
import gnu.classpath.jdwp.exception.InvalidFieldException; |
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.ReferenceTypeId; |
import gnu.classpath.jdwp.id.ReferenceTypeId; |
50 |
import gnu.classpath.jdwp.util.MethodResult; |
import gnu.classpath.jdwp.util.MethodResult; |
61 |
* |
* |
62 |
* @author Aaron Luchko <aluchko@redhat.com> |
* @author Aaron Luchko <aluchko@redhat.com> |
63 |
*/ |
*/ |
64 |
public class ClassTypeCommandSet implements CommandSet |
public class ClassTypeCommandSet |
65 |
|
extends CommandSet |
66 |
{ |
{ |
|
// 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(); |
|
|
|
|
67 |
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) |
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) |
68 |
throws JdwpException |
throws JdwpException |
69 |
{ |
{ |
120 |
|
|
121 |
for (int i = 0; i < numValues; i++) |
for (int i = 0; i < numValues; i++) |
122 |
{ |
{ |
123 |
ObjectId fieldId = idMan.readId(bb); |
ObjectId fieldId = idMan.readObjectId(bb); |
124 |
Field field = (Field) (fieldId.getObject()); |
Field field = (Field) (fieldId.getObject()); |
125 |
Object value = Value.getUntaggedObj(bb, field.getType()); |
Object value = Value.getUntaggedObj(bb, field.getType()); |
126 |
try |
try |
146 |
|
|
147 |
Object value = mr.getReturnedValue(); |
Object value = mr.getReturnedValue(); |
148 |
Exception exception = mr.getThrownException(); |
Exception exception = mr.getThrownException(); |
149 |
ObjectId eId = idMan.getId(exception); |
ObjectId eId = idMan.getObjectId(exception); |
150 |
|
|
151 |
Value.writeTaggedValue(os, value); |
Value.writeTaggedValue(os, value); |
152 |
eId.writeTagged(os); |
eId.writeTagged(os); |
158 |
MethodResult mr = invokeMethod(bb); |
MethodResult mr = invokeMethod(bb); |
159 |
|
|
160 |
Object obj = mr.getReturnedValue(); |
Object obj = mr.getReturnedValue(); |
161 |
ObjectId oId = idMan.getId(obj); |
ObjectId oId = idMan.getObjectId(obj); |
162 |
Exception exception = mr.getThrownException(); |
Exception exception = mr.getThrownException(); |
163 |
ObjectId eId = idMan.getId(exception); |
ObjectId eId = idMan.getObjectId(exception); |
164 |
|
|
165 |
oId.writeTagged(os); |
oId.writeTagged(os); |
166 |
eId.writeTagged(os); |
eId.writeTagged(os); |
175 |
ReferenceTypeId refId = idMan.readReferenceTypeId(bb); |
ReferenceTypeId refId = idMan.readReferenceTypeId(bb); |
176 |
Class clazz = refId.getType(); |
Class clazz = refId.getType(); |
177 |
|
|
178 |
ObjectId tId = idMan.readId(bb); |
ObjectId tId = idMan.readObjectId(bb); |
179 |
Thread thread = (Thread) tId.getObject(); |
Thread thread = (Thread) tId.getObject(); |
180 |
|
|
181 |
ObjectId mId = idMan.readId(bb); |
ObjectId mId = idMan.readObjectId(bb); |
182 |
Method method = (Method) mId.getObject(); |
Method method = (Method) mId.getObject(); |
183 |
|
|
184 |
int args = bb.getInt(); |
int args = bb.getInt(); |