Package com.sun.jdi

Examples of com.sun.jdi.Value


  }

  public static Value findValueInFrame(ThreadReference threadRef, String name,
      ObjectReference thisObj, boolean hasParents)  {
   
    Value value = null;
    try {
      SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      if (!hasParents) {
        LocalVariable localVariable;
View Full Code Here


      }
      sb.deleteCharAt(sb.length() - 1);
      sb.append("]");
      return sb.toString();
    } else if (var instanceof ObjectReference) {
      Value strValue = invoke((ObjectReference) var, "toString",
          new ArrayList());
      return strValue.toString();
    } else {
      return var.toString();
    }
  }
View Full Code Here

  }
 
  public static Value invoke(Object invoker, String methodName, List args) {
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ThreadReference threadRef = threadStack.getCurThreadRef();
    Value value = null;
    Method matchedMethod = null;
    List<Method> methods = null;
    ClassType refType = null;
    ObjectReference obj  = null;
    if (invoker instanceof ClassType) {
View Full Code Here

    }
    Iterator typeIter = argTypes.iterator();
    Iterator valIter = arguments.iterator();
    while (typeIter.hasNext()) {
      Type argType = (Type) typeIter.next();
      Value value = (Value) valIter.next();
      if (value == null) {
        if (isPrimitiveType(argType.name()))
          return false;
      }
      if (!value.type().equals(argType)) {
        if (isAssignableTo(value.type(), argType)) {
          return true;
        } else {
          return false;
        }
      }
View Full Code Here

      ParseResult result = AstTreeFactory.getExpressionAst(exp);
      if (result.hasError()) {
        return result.getErrorMsg();
      }
      Object obj = evalTreeNode(result.getTree());
      Value value = null;
      if (obj instanceof Integer) {
        value = vm.mirrorOf(((Integer)obj).intValue());
      } else if (obj instanceof Boolean) {
        value = vm.mirrorOf(((Boolean)obj).booleanValue());
      } else if (obj instanceof String) {
View Full Code Here

      for (LocalVariable var : threadRef.frame(curFrame).visibleVariables()) {
        varNames.add(var.name());
      }
      int maxLen = getMaxLength(varNames)+2;
      for (LocalVariable var : threadRef.frame(curFrame).visibleVariables()) {
        Value value = threadRef.frame(curFrame).getValue(var);
        sb.append(padStr(maxLen,var.name())).append(":");
        sb.append(getPrettyPrintStr(value));
        sb.append("\n");
      }
    } catch (AbsentInformationException e) {
View Full Code Here

  public static String reftype(String exp) {
    ParseResult result = AstTreeFactory.getExpressionAst(exp);
    if (result.hasError()) {
      return result.getErrorMsg();
    }
    Value value = (Value)evalTreeNode(result.getTree());
    return value.type().name();
  }
View Full Code Here

  public static String inspect(String exp) {
    ParseResult result = AstTreeFactory.getExpressionAst(exp);
    if (result.hasError()) {
      return result.getErrorMsg();
    }
    Value value = (Value)evalTreeNode(result.getTree());
   
    StringBuilder sb = new StringBuilder();
    if (value instanceof ObjectReference) {
      sb.append(exp).append(" = ");
      sb.append(value.type().name()).append("\n");
     
      ObjectReference objRef = (ObjectReference) value;
      Map<Field, Value> values = objRef.getValues(objRef.referenceType().visibleFields());
      List<String> fieldNames = new ArrayList<String>();
      for (Field field : values.keySet()) {
View Full Code Here

    ThreadReference threadRef = checkAndGetCurrentThread();
    try {
      SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      ObjectReference thisObj = stackFrame.thisObject();
      Value value = findValueInFrame(threadRef, name, thisObj);
      return value;
    } catch (IncompatibleThreadStateException e) {
      throw new ExpressionEvalException("eval expression error, caused by : " + e.getMessage());
    }
  }
View Full Code Here

    ThreadReference threadRef = checkAndGetCurrentThread();
    ObjectReference thisObj = null;
   
    try {
      thisObj = (ObjectReference)evalTreeNode(objNode);
      Value value = findValueInFrame(threadRef, memberName, thisObj);
      return value;
    } catch (VariableOrFieldNotFoundException e) {
      ReferenceType refType = getClassType(objNode.getText());
      Field field = refType.fieldByName(memberName);
      Value value = refType.getValue(field);
      return value;
    }
   
  }
View Full Code Here

TOP

Related Classes of com.sun.jdi.Value

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.