Java Code Examples for com.sun.jdi.ClassType#INVOKE_SINGLE_THREADED
The following examples show how to use
com.sun.jdi.ClassType#INVOKE_SINGLE_THREADED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvokableTypeImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { /* * Cache the values of args when TRACE_SENDS is enabled, for later printing. * If not cached, printing causes a remote call while synchronized, and deadlock. */ if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) { for (ValueImpl arg: args) { arg.toString(); } } CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 2
Source File: InvokableTypeImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { /* * Cache the values of args when TRACE_SENDS is enabled, for later printing. * If not cached, printing causes a remote call while synchronized, and deadlock. */ if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) { for (ValueImpl arg: args) { arg.toString(); } } CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 3
Source File: InvokableTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { /* * Cache the values of args when TRACE_SENDS is enabled, for later printing. * If not cached, printing causes a remote call while synchronized, and deadlock. */ if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) { for (ValueImpl arg: args) { arg.toString(); } } CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 4
Source File: InvokableTypeImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { /* * Cache the values of args when TRACE_SENDS is enabled, for later printing. * If not cached, printing causes a remote call while synchronized, and deadlock. */ if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) { for (ValueImpl arg: args) { arg.toString(); } } CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 5
Source File: InvokableTypeImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 6
Source File: InvokableTypeImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 7
Source File: InvokableTypeImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 8
Source File: InvokableTypeImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 9
Source File: InvokableTypeImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 10
Source File: InvokableTypeImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 11
Source File: InvokableTypeImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 12
Source File: InvokableTypeImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 13
Source File: InvokableTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 14
Source File: InvokableTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 15
Source File: InvokableTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 16
Source File: InvokableTypeImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 17
Source File: InvokableTypeImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 18
Source File: InvokableTypeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }
Example 19
Source File: InvokableTypeImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Method invocation support. * Shared by ClassType and InterfaceType * @param threadIntf the thread in which to invoke. * @param methodIntf method the {@link Method} to invoke. * @param origArguments the list of {@link Value} arguments bound to the * invoked method. Values from the list are assigned to arguments * in the order they appear in the method signature. * @param options the integer bit flag options. * @return a {@link Value} mirror of the invoked method's return value. * @throws java.lang.IllegalArgumentException if the method is not * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. * @throws {@link InvalidTypeException} if any argument in the * argument list is not assignable to the corresponding method argument * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not * been suspended by an event. * @throws InvocationException if the method invocation resulted in * an exception in the target VM. * @throws InvalidTypeException If the arguments do not meet this requirement -- * Object arguments must be assignment compatible with the argument * type. This implies that the argument type must be * loaded through the enclosing class's class loader. * Primitive arguments must be either assignment compatible with the * argument type or must be convertible to the argument type without loss * of information. See JLS section 5.2 for more information on assignment * compatibility. * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. */ final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, List<? extends Value> origArguments, int options) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException { validateMirror(threadIntf); validateMirror(methodIntf); validateMirrorsOrNulls(origArguments); MethodImpl method = (MethodImpl) methodIntf; ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; validateMethodInvocation(method); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); ValueImpl[] args = arguments.toArray(new ValueImpl[0]); InvocationResult ret; try { PacketStream stream = sendInvokeCommand(thread, method, args, options); ret = waitForReply(stream); } catch (JDWPException exc) { if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { throw new IncompatibleThreadStateException(); } else { throw exc.toJDIException(); } } /* * There is an implict VM-wide suspend at the conclusion * of a normal (non-single-threaded) method invoke */ if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { vm.notifySuspend(); } if (ret.getException() != null) { throw new InvocationException(ret.getException()); } else { return ret.getResult(); } }
Example 20
Source File: InvokableTypeImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, final MethodImpl method, final ValueImpl[] args, final int options) { CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { stream = thread.sendResumingCommand(sender); } else { stream = vm.sendResumingCommand(sender); } return stream; }