/** * Evaluates the given code in the state of the current execution and in the same guest language * as the current language is defined in. Returns a heap value that remains valid even if this * stack frame becomes invalid. * * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @param code the code to evaluate * @return the return value of the expression * @since 0.17 */ public DebugValue eval(String code) { verifyValidState(false); Object result; try { result = DebuggerSession.evalInContext(event, code, currentFrame); } catch (IOException e) { throw new RuntimeException(e); } return wrapHeapValue(result); }
/** * Returns the return value of the currently executed source location. Returns <code>null</code> * if the execution is suspended {@link SuspendAnchor#BEFORE before} a guest language location. * The returned value is <code>null</code> if an exception occurred during execution of the * instrumented source element, the exception is provided by {@link #getException()}. * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @since 0.17 */ public DebugValue getReturnValue() { verifyValidState(false); Object ret = returnValue; if (ret == null) { return null; } return getTopStackFrame().wrapHeapValue(ret); }
/** * Returns the return value of the currently executed source location. Returns <code>null</code> * if the execution is suspended {@link SuspendAnchor#BEFORE before} a guest language location. * The returned value is <code>null</code> if an exception occurred during execution of the * instrumented source element. The debug value remains valid event if the current execution was * suspend. * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @since 0.17 */ public DebugValue getReturnValue() { verifyValidState(false); Object ret = returnValue; if (ret == null) { return null; } return getTopStackFrame().wrapHeapValue(ret); }
/** * Evaluates the given code in the state of the current execution and in the same guest language * as the current language is defined in. Returns a heap value that remains valid even if this * stack frame becomes invalid. * * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @param code the code to evaluate * @return the return value of the expression * @throws DebugException when guest language code throws an exception * @throws IllegalStateException if called on another thread than this frame was created with, * or if {@link #getLanguage() language} of this frame is not * {@link LanguageInfo#isInteractive() interactive}. * @since 0.17 */ public DebugValue eval(String code) throws DebugException { verifyValidState(false); Object result = DebuggerSession.evalInContext(event, code, currentFrame); return wrapHeapValue(result); }
/** * Returns the input values of the current source element gathered from return values of it's * executed children. The input values are available only during stepping through the source * elements hierarchy and only on {@link SuspendAnchor#AFTER AFTER} {@link #getSuspendAnchor() * suspend anchor}. There can be <code>null</code> values in the returned array for children we * did not intercept return values from. * * @return the array of input values, or <code>null</code> when no input is available. * @since 0.33 */ public DebugValue[] getInputValues() { if (inputValuesProvider == null) { return null; } Object[] inputValues = inputValuesProvider.getDebugInputValues(materializedFrame); int n = inputValues.length; DebugValue[] values = new DebugValue[n]; for (int i = 0; i < n; i++) { if (inputValues[i] != null) { values[i] = getTopStackFrame().wrapHeapValue(inputValues[i]); } else { values[i] = null; } } return values; }
/** * Returns the input values of the current source element gathered from return values of it's * executed children. The input values are available only during stepping through the source * elements hierarchy and only on {@link SuspendAnchor#AFTER AFTER} {@link #getSuspendAnchor() * suspend anchor}. There can be <code>null</code> values in the returned array for children we * did not intercept return values from. * * @return the array of input values, or <code>null</code> when no input is available. * @since 0.33 */ public DebugValue[] getInputValues() { if (inputValuesProvider == null) { return null; } Object[] inputValues = inputValuesProvider.getDebugInputValues(materializedFrame); int n = inputValues.length; DebugValue[] values = new DebugValue[n]; for (int i = 0; i < n; i++) { if (inputValues[i] != null) { values[i] = getTopStackFrame().wrapHeapValue(inputValues[i]); } else { values[i] = null; } } return values; }