Ejemplo n.º 1
0
 public Value getLocalVariableValue(StackFrame fr, String localName)
     throws AbsentInformationException, IncompatibleThreadStateException {
   Value ret = null;
   LocalVariable var = fr.visibleVariableByName(localName);
   if (var != null) {
     ret = fr.getValue(var);
   }
   return ret;
 }
Ejemplo n.º 2
0
 public Value getLocalVariableValue(ThreadReference tr, int frameIdx, String localName)
     throws AbsentInformationException, IncompatibleThreadStateException {
   StackFrame fr = tr.frame(frameIdx);
   Value ret = null;
   LocalVariable var = fr.visibleVariableByName(localName);
   if (var != null) {
     ret = fr.getValue(var);
   }
   return ret;
 }
Ejemplo n.º 3
0
 public StringReference getLocalVariableValueAsString(StackFrame fr, String localName)
     throws AbsentInformationException, IncompatibleThreadStateException {
   Value val = null;
   StringReference ret = null;
   LocalVariable var = fr.visibleVariableByName(localName);
   if (var != null) {
     val = fr.getValue(var);
     if (val instanceof StringReference) {
       ret = (StringReference) fr.getValue(var);
     } else {
       LOGGER.warn(
           "getLocalVariableValueAsString called with non-String Object: "
               + var.getClass().getName());
     }
   } else {
     LOGGER.warn("LocalVariable with name: " + localName + " was not found");
   }
   return ret;
 }
Ejemplo n.º 4
0
 /*
  * This function appears to take an exorbitant amount of time why why why
  */
 public boolean setLocalVariableValue(int i, String name, Value sf)
     throws IncompatibleThreadStateException, InvalidTypeException, ClassNotLoadedException,
         AbsentInformationException {
   StackFrame frame = this.currentThread.frames().get(i);
   LocalVariable var = frame.visibleVariableByName(name);
   LOGGER.info("got var: " + var.typeName());
   try {
     frame.setValue(var, sf);
     LOGGER.info("success setting new variable value");
     return true;
   } catch (java.lang.ClassCastException e) {
     /*
      * KNOWN ISSUE: when checking type compatibility the debugger
      * requests the ClassLoader of the type of the variable. When an
      * object is loaded via reflection (using the current method) this
      * will return an ObjectReference. The debugger is expecting a
      * ClassLoaderReference and apparently the ObjectReference cannot be
      * cast to a ClassLoaderReference.
      */
     LOGGER.info(
         "ClassCastException due to type assignments with classes loaded via reflection, work around is to load class again");
   }
   return false;
 }