Esempio n. 1
0
  @Override
  public List<IWatchable> getVisibleWatchables() {
    try {
      StackFrame stackFrame = getStackFrame();
      List<IWatchable> result = new ArrayList<IWatchable>();

      if (stackFrame != null) {
        for (LocalVariable variable : stackFrame.visibleVariables()) {
          result.add(new JavaLocalVariable(variable, this, myClassFqName, myThreadReference));
        }

        ObjectReference thisObject = stackFrame.thisObject();
        if (thisObject != null) {
          result.add(new JavaThisObject(thisObject, this, myClassFqName, myThreadReference));
        } else {
          result.add(
              new JavaStaticContext(
                  getStackFrame().location().declaringType(), myClassFqName, myThreadReference));
        }
      }

      return result;
    } catch (InvalidStackFrameException ex) {
      LOG.warning(
          "InvalidStackFrameException",
          ex); // TODO something should be done here. See, for instance, how idea deals with those
               // exceptions
      return Collections.emptyList();
    } catch (AbsentInformationException ex) {
      // doing nothing, variables are just not available for us
      return Collections.emptyList();
    }
  }
Esempio n. 2
0
 @Override
 public Map<IWatchable, IValue> getWatchableValues() {
   try {
     StackFrame stackFrame = getStackFrame();
     Map<IWatchable, IValue> result = new HashMap<IWatchable, IValue>();
     if (stackFrame != null) {
       Map<LocalVariable, Value> map = stackFrame.getValues(stackFrame.visibleVariables());
       for (LocalVariable variable : map.keySet()) {
         result.put(
             new JavaLocalVariable(variable, this, myClassFqName, stackFrame.thread()),
             JavaValue.fromJDIValue(map.get(variable), myClassFqName, stackFrame.thread()));
       }
       ObjectReference thisObject = stackFrame.thisObject();
       if (thisObject != null) {
         JavaThisObject object =
             new JavaThisObject(thisObject, this, myClassFqName, stackFrame.thread());
         result.put(object, object.getValue());
       }
     }
     return result;
   } catch (AbsentInformationException ex) {
     // doing nothing
     return Collections.emptyMap();
   }
 }