Package com.sun.jdi

Examples of com.sun.jdi.ObjectReference


      LocalVariable localVariable;
      localVariable = stackFrame.visibleVariableByName(name);
      if (localVariable != null) {
        stackFrame.setValue(localVariable, value);
      } else {
        ObjectReference thisObj = stackFrame.thisObject();
        if (thisObj == null) {
          return "can't find field or variable with name '"+name+"'";
        }
        ReferenceType refType = thisObj.referenceType();
        Field field = refType.fieldByName(name);
        thisObj.setValue(field, value);
      }
    } catch (Throwable e) {
      return e.getMessage();
    }
    return "success";
View Full Code Here


    ThreadReference threadRef = checkAndGetCurrentThread();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    StringBuilder sb = new StringBuilder();
    try {
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      ObjectReference thisObj = stackFrame.thisObject();
      Map<Field, Value> values = thisObj.getValues(thisObj.referenceType().visibleFields());
      List<String> fieldNames = new ArrayList<String>();
      for (Field field : values.keySet()) {
        fieldNames.add(field.name());
      }
      int maxLen = getMaxLength(fieldNames)+2;
View Full Code Here

    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()) {
        if (field.isStatic()) continue;
        fieldNames.add(field.name());
      }
View Full Code Here

  private static Value evalJdiVar(String name) {
    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

   
    CommonTree objNode = (CommonTree)node.getChild(0);
    String memberName = node.getChild(1).getText();
   
    ThreadReference threadRef = checkAndGetCurrentThread();
    ObjectReference thisObj = null;
   
    try {
      thisObj = (ObjectReference)evalTreeNode(objNode);
      Value value = findValueInFrame(threadRef, memberName, thisObj);
      return value;
View Full Code Here

    ThreadReference threadRef = threadStack.getCurThreadRef();
    Value value = null;
    Method matchedMethod = null;
    List<Method> methods = null;
    ClassType refType = null;
    ObjectReference obj  = null;
    if (invoker instanceof ClassType) {
      refType = (ClassType)invoker;
        methods = refType.methodsByName(methodName);
    } else {
       obj = (ObjectReference)invoker;
       methods = obj.referenceType().methodsByName(methodName);
    }
    if (methods == null || methods.size() == 0) {
      throw new ExpressionEvalException("eval expression error, method '" + methodName + "' can't be found");
    }
    if (methods.size() == 1) {
      matchedMethod = methods.get(0);
    } else {
      matchedMethod = findMatchedMethod(methods, args);
    }
    try {
        if (invoker instanceof ClassType) {
         ClassType clazz = (ClassType)refType;
         value = clazz.invokeMethod(threadRef, matchedMethod, args,
          ObjectReference.INVOKE_SINGLE_THREADED);
        } else {
          value = obj.invokeMethod(threadRef, matchedMethod, args,
            ObjectReference.INVOKE_SINGLE_THREADED);
        }
    } catch (InvalidTypeException e) {
      e.printStackTrace();
      throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
View Full Code Here

    ThreadReference threadRef = checkAndGetCurrentThread();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    StringBuilder sb = new StringBuilder();
    try {
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      ObjectReference thisObj = stackFrame.thisObject();
      Map<Field, Value> values = thisObj.getValues(thisObj.referenceType().visibleFields());
      List<String> fieldNames = new ArrayList<String>();
      for (Field field : values.keySet()) {
        fieldNames.add(field.name());
      }
      int maxLen = getMaxLength(fieldNames)+2;
View Full Code Here

    StringBuilder sb = new StringBuilder();
    if (value instanceof ObjectReference) {
      sb.append(exp.getOriExp()).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()) {
        if (field.isStatic()) continue;
        fieldNames.add(field.name());
      }
View Full Code Here

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

    ThreadReference threadRef = threadStack.getCurThreadRef();
    Value value = null;
    Method matchedMethod = null;
    List<Method> methods = null;
    ClassType refType = null;
    ObjectReference obj  = null;
    if (invoker instanceof ClassType) {
      refType = (ClassType)invoker;
        methods = refType.methodsByName(methodName);
    } else {
       obj = (ObjectReference)invoker;
       methods = obj.referenceType().methodsByName(methodName);
    }
    if (methods == null || methods.size() == 0) {
      throw new ExpressionEvalException("eval expression error, method '" + methodName + "' can't be found");
    }
    if (methods.size() == 1) {
      matchedMethod = methods.get(0);
    } else {
      matchedMethod = findMatchedMethod(methods, args);
    }
    try {
        if (invoker instanceof ClassType) {
         ClassType clazz = (ClassType)refType;
         value = clazz.invokeMethod(threadRef, matchedMethod, args,
          ObjectReference.INVOKE_SINGLE_THREADED);
        } else {
          value = obj.invokeMethod(threadRef, matchedMethod, args,
            ObjectReference.INVOKE_SINGLE_THREADED);
        }
    } catch (InvalidTypeException e) {
      e.printStackTrace();
      throw new ExpressionEvalException("eval expression error, caused by :" + e.getMessage());
View Full Code Here

TOP

Related Classes of com.sun.jdi.ObjectReference

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.