Package com.sun.jdi

Examples of com.sun.jdi.ArrayReference


   * @return the {@link ClassType} instance
   */
  public ClassType inject(byte[] clazz, String argsForInstantiate) throws Exception {

    // build a byte array and fill it
    final ArrayReference array = buildArray(_byte, clazz.length);
    ByteValue[] byteValues = new ByteValue[clazz.length];
    for (int i = 0; i < clazz.length; i++) {
      byteValues[i] = virtualMachine.mirrorOf(clazz[i]);
    }
    array.setValues(Arrays.asList(byteValues));

    // load the class with the class loader
    final ObjectReference loadedClazz = (ObjectReference) invokeMethod(myClassLoader, _URLClassLoader, "defineClass", "([BII)Ljava/lang/Class;", new Value[] { array, virtualMachine.mirrorOf(0), virtualMachine.mirrorOf(clazz.length) });
    final ClassType _clazz = (ClassType) ((ClassObjectReference) loadedClazz).reflectedType();

View Full Code Here


            final Location loc = be.location();
            final ThreadReference tr = be.thread()
            if (loc.equals(interceptIn)) {
              LocalVariable result = (LocalVariable) loc.method().variablesByName("result").get(0);
              LocalVariable buffer = (LocalVariable) loc.method().arguments().get(0);
              ArrayReference buf = (ArrayReference) tr.frame(0).getValue(buffer);
              new InputInterceptHandler(tr, buf, result).start();
            } else if (loc.equals(interceptOut)) {
              LocalVariable result = (LocalVariable) loc.method().variablesByName("result").get(0);
              LocalVariable data = (LocalVariable) loc.method().arguments().get(0);
              ArrayReference buf = (ArrayReference) tr.frame(0).getValue(data);
              List values = buf.getValues();
              byte[] temp = new byte[buf.length()];
              for (int i = 0; i < temp.length; i++) {
                temp[i] = ((ByteValue)values.get(i)).byteValue();
              }
              pipedOut.write(temp);
              pipedOut.flush();
View Full Code Here

  /**
   * Returns this variable's current underlying value.
   */
  @Override
  protected Value retrieveValue() {
    ArrayReference ar = getArrayReference();
    if (ar != null) {
      return ar.getValue(getIndex());
    }
    return null;
  }
View Full Code Here

    return "[" + getIndex() + "]"; //$NON-NLS-2$ //$NON-NLS-1$
  }

  @Override
  protected void setJDIValue(Value value) throws DebugException {
    ArrayReference ar = getArrayReference();
    if (ar == null) {
      requestFailed(
          JDIDebugModelMessages.JDIArrayEntryVariable_value_modification_failed,
          null);
    }
    try {
      ar.setValue(getIndex(), value);
      fireChangeEvent(DebugEvent.CONTENT);
    } catch (ClassNotLoadedException e) {
      targetRequestFailed(
          MessageFormat.format(
              JDIDebugModelMessages.JDIArrayEntryVariable_exception_modifying_variable_value,
View Full Code Here

  /**
   * @see IJavaArrayType#newInstance(int)
   */
  public IJavaArray newInstance(int size) throws DebugException {
    try {
      ArrayReference ar = ((ArrayType) getUnderlyingType())
          .newInstance(size);
      return (IJavaArray) JDIValue.createValue(getJavaDebugTarget(), ar);
    } catch (RuntimeException e) {
      targetRequestFailed(
          MessageFormat.format(
View Full Code Here

            return false;
        }

        // handle arrays
        if (getType() == TYPE_ARRAY) {
            ArrayReference array = (ArrayReference) value;
            return array.length() > 0;
        }
        // handle objects
        if (getType() == TYPE_OBJECT) { // this also rules out null
            // check if this object has any fields
            ObjectReference obj = (ObjectReference) value;
View Full Code Here

TOP

Related Classes of com.sun.jdi.ArrayReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.