/** * 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); }
/** * Find a list of top scopes of a language. The iteration order corresponds with the scope * nesting, from the inner-most to the outer-most. * * @param languageId a language id. * @return a list of top scopes, can be empty when no top scopes are provided by the * language * @see TruffleLanguage#findTopScopes(java.lang.Object) * @since 0.30 */ public Iterable<Scope> findTopScopes(String languageId) { LanguageInfo languageInfo = getLanguages().get(languageId); if (languageInfo == null) { throw new IllegalArgumentException("Unknown language: " + languageId + ". Known languages are: " + getLanguages().keySet()); } final TruffleLanguage.Env env = AccessorInstrumentHandler.engineAccess().getEnvForInstrument(languageInfo); return findTopScopes(env); }
/** * Find a list of top scopes of a language. The iteration order corresponds with the scope * nesting, from the inner-most to the outer-most. * * @param languageId a language id. * @return a list of top scopes, can be empty when no top scopes are provided by the * language * @see TruffleLanguage#findTopScopes(java.lang.Object) * @since 0.30 */ public Iterable<Scope> findTopScopes(String languageId) { LanguageInfo languageInfo = getLanguages().get(languageId); if (languageInfo == null) { throw new IllegalArgumentException("Unknown language: " + languageId + ". Known languages are: " + getLanguages().keySet()); } final TruffleLanguage.Env env = AccessorInstrumentHandler.engineAccess().getEnvForInstrument(languageInfo); return findTopScopes(env); }
/** * 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); } }
@Override public Iterable<Scope> findTopScopes(TruffleLanguage.Env env) { return TruffleInstrument.Env.findTopScopes(env); }
@Override public Iterable<Scope> findTopScopes(TruffleLanguage.Env env) { return TruffleInstrument.Env.findTopScopes(env); }