/** * Get a parent scope. * * @return the parent scope, or <code>null</code>. * @since 0.26 */ public DebugScope getParent() { verifyValidState(); if (parent == null && iterator.hasNext()) { parent = new DebugScope(iterator.next(), iterator, debugger, event, frame, root, language); } return parent; }
private ValuePropertiesCollection getVariables() { verifyValidState(); if (variables == null) { Object variablesObj = scope.getVariables(); variables = DebugValue.getProperties(variablesObj, debugger, getLanguage(), this); } return variables; }
/** * Get local variables declared in this scope, valid at the current suspension point. Call this * method on {@link #getParent() parent}, to get values of variables declared in parent scope, * if any. * <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.26 */ public Iterable<DebugValue> getDeclaredValues() { return getVariables(); }
DebugScope scope = getScope(); while (scope != null) { DebugValue value = scope.getDeclaredValue(name); if (value != null) { return value; if (scope.isFunctionScope()) { break; scope = scope.getParent();
variables = scope.getDeclaredValues().iterator(); if (!variables.hasNext()) { variables = null; if (scope.isFunctionScope()) { scope = scope.getParent();
/** * Returns a language top scope. The top scopes have global validity and unlike * {@link DebugStackFrame#getScope()} have no relation to the suspended location. * * @since 0.30 */ public DebugScope getTopScope(String languageId) { LanguageInfo info = debugger.getEnv().getLanguages().get(languageId); if (info == null) { return null; } Iterable<Scope> scopes = debugger.getEnv().findTopScopes(languageId); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, debugger, info); }
private void checkValid() { if (scope != null) { scope.verifyValidState(); } } }
final LanguageInfo resolveLanguage() { LanguageInfo languageInfo; if (preferredLanguage != null) { languageInfo = preferredLanguage; } else if (getScope() != null && getScope().getLanguage() != null) { languageInfo = getScope().getLanguage(); } else { languageInfo = getOriginalLanguage(); } return languageInfo; }
DebugScope scope = getScope(); while (scope != null) { DebugValue value = scope.getDeclaredValue(name); if (value != null) { return value; if (scope.isFunctionScope()) { break; scope = scope.getParent();
variables = scope.getDeclaredValues().iterator(); if (!variables.hasNext()) { variables = null; if (scope.isFunctionScope()) { scope = scope.getParent();
/** * Returns a language top scope. The top scopes have global validity and unlike * {@link DebugStackFrame#getScope()} have no relation to the suspended location. * * @throws DebugException when guest language code throws an exception * @since 0.30 */ public DebugScope getTopScope(String languageId) throws DebugException { LanguageInfo info = debugger.getEnv().getLanguages().get(languageId); if (info == null) { return null; } try { Iterable<Scope> scopes = debugger.getEnv().findTopScopes(languageId); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, this, info); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(this, ex, info, null, true, null); } }
private void checkValid() { if (scope != null) { scope.verifyValidState(); } }
final LanguageInfo resolveLanguage() { LanguageInfo languageInfo; if (preferredLanguage != null) { languageInfo = preferredLanguage; } else if (getScope() != null && getScope().getLanguage() != null) { languageInfo = getScope().getLanguage(); } else { languageInfo = getOriginalLanguage(); } return languageInfo; }
private ValuePropertiesCollection getVariables() { verifyValidState(); try { if (variables == null) { Object variablesObj = scope.getVariables(); variables = DebugValue.getProperties(variablesObj, session, getLanguage(), this); } } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(session, ex, language, null, true, null); } return variables; }
/** * Get a parent scope. * * @return the parent scope, or <code>null</code>. * @throws DebugException when guest language code throws an exception * @since 0.26 */ public DebugScope getParent() throws DebugException { verifyValidState(); try { if (parent == null && iterator.hasNext()) { parent = new DebugScope(iterator.next(), iterator, session, event, frame, root, language); } } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(session, ex, language, null, true, null); } return parent; }
/** * Get the current inner-most scope. The scope might not provide valid information if the * execution path diverges from this trace element. * * @return the scope, or <code>null</code> when no language is associated with this frame * location, or when no local scope exists. * @since 1.0 */ public DebugScope getScope() { Node node = traceElement.getLocation(); if (node == null) { return null; } RootNode root = node.getRootNode(); if (root.getLanguageInfo() == null) { // no language, no scopes return null; } Frame elementFrame = traceElement.getFrame(); MaterializedFrame frame = (elementFrame != null) ? elementFrame.materialize() : null; Iterable<Scope> scopes = session.getDebugger().getEnv().findLocalScopes(node, frame); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, session, null, frame, root); }
private void checkValid() { if (scope != null) { scope.verifyValidState(); } } }
/** * Get local variables declared in this scope, valid at the current suspension point. Call this * method on {@link #getParent() parent}, to get values of variables declared in parent scope, * if any. * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @throws DebugException when guest language code throws an exception * @since 0.26 */ public Iterable<DebugValue> getDeclaredValues() throws DebugException { return getVariables(); }
/** * Get arguments of this scope. If this scope is a {@link #isFunctionScope() function} scope, * function arguments are returned. * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @return an iterable of arguments, or <code>null</code> when this scope does not have a * concept of arguments. * @since 0.26 */ public Iterable<DebugValue> getArguments() { verifyValidState(); Object argumentsObj = scope.getArguments(); Iterable<DebugValue> arguments = null; if (argumentsObj != null && argumentsObj instanceof TruffleObject) { TruffleObject argsTO = (TruffleObject) argumentsObj; arguments = DebugValue.getProperties(argumentsObj, debugger, getLanguage(), this); if (arguments == null && ObjectStructures.isArray(debugger.getMessageNodes(), argsTO)) { List<Object> array = ObjectStructures.asList(debugger.getMessageNodes(), argsTO); arguments = new ValueInteropList(debugger, getLanguage(), array); } } return arguments; }
return null; return new DebugScope(it.next(), it, debugger, event, frame, root);