public boolean isArgument() {
   try {
     MethodImpl method = (MethodImpl) scopeStart.method();
     return (slot < method.argSlotCount());
   } catch (AbsentInformationException e) {
     // If this variable object exists, there shouldn't be absent info
     throw new InternalException();
   }
 }
Ejemplo n.º 2
0
  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]);
    JDWP.ClassType.InvokeMethod ret;
    try {
      PacketStream stream = sendInvokeCommand(thread, method, args, options);
      ret = JDWP.ClassType.InvokeMethod.waitForReply(vm, 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 & INVOKE_SINGLE_THREADED) == 0) {
      vm.notifySuspend();
    }

    if (ret.exception != null) {
      throw new InvocationException(ret.exception);
    } else {
      return ret.returnValue;
    }
  }