public static boolean hasSourceInfo(JPDADebugger debugger) { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return false; } JPDAClassType supportClass = supportClasses.get(0); try { ReferenceType supportType = (ReferenceType) supportClass.getClass().getMethod("getType").invoke(supportClass); Method getSourceInfoMethod = ((ClassType) supportType).concreteMethodByName(METHOD_SOURCE_INFO, SIGNAT_SOURCE_INFO); return getSourceInfoMethod != null; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { Exceptions.printStackTrace(ex); return false; } catch (VMDisconnectedException | ClassNotPreparedException ex) { return false; } }
public static Variable getSourceInfo(JPDADebugger debugger, JPDAClassType classType) { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return null; } JPDAClassType supportClass = supportClasses.get(0); try { Variable sourceInfo = supportClass.invokeMethod(METHOD_SOURCE_INFO, SIGNAT_SOURCE_INFO, new Variable[] { classType.classObject() }); return sourceInfo; } catch (NoSuchMethodException | InvalidExpressionException ex) { return null; } }
static Variable[] getValueInfos(JPDADebugger debugger, Variable scope, boolean all) { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return null; } JPDAClassType supportClass = supportClasses.get(0); Variable[] args = new Variable[2]; try { args[0] = scope; args[1] = debugger.createMirrorVar(all, true); ObjectVariable infosVar = (ObjectVariable) supportClass.invokeMethod(METHOD_VALUE_INFOS, SIGNAT_VALUE_INFOS, args); return infosVar.getFields(0, Integer.MAX_VALUE); } catch (InvalidObjectException ioex) { return null; } catch (NoSuchMethodException | InvalidExpressionException nsmex) { Exceptions.printStackTrace(nsmex); return null; } }
public static Variable getVarStringValueAsVar(JPDADebugger debugger, ObjectVariable ov) { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return ov; } JPDAClassType supportClass = supportClasses.get(0); Variable[] args = new Variable[1]; try { args[0] = ov; Variable strVar = supportClass.invokeMethod(METHOD_VALUE_AS_STRING, SIGNAT_VALUE_AS_STRING, args); // This method returns quoted value. :-( if (String.class.getName().equals(strVar.getType())) { return adjustQuotes(debugger, (ObjectVariable) strVar); } else { return strVar; } } catch (NoSuchMethodException | InvalidExpressionException ex) { Exceptions.printStackTrace(ex); return ov; } }
static Variable getValueInfoDesc(JPDADebugger debugger, String name, Variable value, boolean all) { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return null; } JPDAClassType supportClass = supportClasses.get(0); Variable[] args = new Variable[3]; try { args[0] = debugger.createMirrorVar(name); args[1] = value; args[2] = debugger.createMirrorVar(all, true); return supportClass.invokeMethod(METHOD_VALUE_INFO, SIGNAT_VALUE_INFO, args); } catch (InvalidObjectException | InvalidExpressionException iex) { return null; } catch (NoSuchMethodException nsmex) { Exceptions.printStackTrace(nsmex); return null; } }
public static String getVarValue(JPDADebugger debugger, Variable var) { if (var instanceof ObjectVariable) { ObjectVariable ov = (ObjectVariable) var; List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { try {
public static Variable evaluate(JPDADebugger debugger, CallStackFrame frame, String expression, ObjectVariable contextVar) throws InvalidExpressionException { List<JPDAClassType> supportClasses = debugger.getClassesByName(DEBUGGER_SUPPORT_CLASS); if (supportClasses.isEmpty()) { return null;