}
private void executeInvokeMethod(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
ObjectId oid = idMan.readObjectId(bb);
Object obj = oid.getObject();
ObjectId tid = idMan.readObjectId(bb);
Thread thread = (Thread) tid.getObject();
ReferenceTypeId rid = idMan.readReferenceTypeId(bb);
Class clazz = rid.getType();
ObjectId mid = idMan.readObjectId(bb);
Method method = (Method) mid.getObject();
int args = bb.getInt();
Object[] values = new Object[args];
for (int i = 0; i < args; i++)
{
values[i] = Value.getObj(bb);
}
int invokeOptions = bb.getInt();
boolean suspend = ((invokeOptions
& JdwpConstants.InvokeOptions.INVOKE_SINGLE_THREADED)
!= 0);
if (suspend)
{
// We must suspend all other running threads first
VMVirtualMachine.suspendAllThreads ();
}
boolean nonVirtual = ((invokeOptions
& JdwpConstants.InvokeOptions.INVOKE_NONVIRTUAL)
!= 0);
MethodResult mr = VMVirtualMachine.executeMethod(obj, thread,
clazz, method,
values, nonVirtual);
Object value = mr.getReturnedValue();
Exception exception = mr.getThrownException();
ObjectId eId = idMan.getObjectId(exception);
Value.writeTaggedValue(os, value);
eId.writeTagged(os);
}