/** * 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); }
/** * 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); }
return evalInContext(ev, node, frame, code); } catch (KillException kex) { throw new DebugException(ev.getSession(), "Evaluation was killed.", null, true, null);