Elide GraalVM25.6.0-elide.4
All types
Versions and modules

DebugStackFrame

Javaclassin com.oracle.truffle.api.debugsince 0.17

public final class DebugStackFrame
Inheritance
  1. Object
  2. DebugStackFrame

Represents a frame in the guest language stack. A guest language stack frame consists of a name, the current source location and scopes containing local variables and arguments. Furthermore it allows to evaluate guest language expressions in the lexical context of a particular frame.

Debug stack frames are only valid as long as suspended events are valid. Suspended events are valid as long while the originating SuspendedCallback is still executing. All methods of the frame throw IllegalStateException if they become invalid.

Depending on the method, clients may access the stack frame only on the execution thread where the suspended event of the stack frame was created and the notification was received. For some methods, access from other threads may throw IllegalStateException. Please see the javadoc of the individual method for details.

Methods12

boolean isInternal()

isInternal

since 0.17
public boolean isInternal()

Returns whether this stack frame is a language implementation artifact that should be hidden during normal guest language debugging, for example in stack traces.

Language implementations sometimes create method calls internally that do not correspond to anything explicitly written by a programmer, for example when the body of a looping construct is implemented as callable block. Language implementors mark these methods as internal.

Clients of the debugging API should assume that displaying internal frames is unlikely to help programmers debug guest language programs and might possibly create confusion. However, clients may choose to display all frames, for example in a special mode to support development of programming language implementations.

The decision to mark a method as internal is language-specific, reflects judgments about tool usability, and is subject to change.

This method is thread-safe.

Returns

boolean
No description.
boolean isHost()

isHost

since 20.3
public boolean isHost()

Returns true if this frame is a host frame. Host frames provide stack trace element, have no scope, no source section and can not evaluate code.

Host frames are provided only when host info is set to true.

Returns

boolean
No description.
StackTraceElement getHostTraceElement()

getHostTraceElement

since 20.3
public StackTraceElement getHostTraceElement()

Provides a host frame. Returns the host stack trace element if and only if this is host frame.

Returns

StackTraceElement
the host stack trace element, or null when not a host frame.

See also

String getName()

getName

since 0.17
public String getName() throws DebugException

A description of the AST (expected to be a method or procedure name in most languages) that identifies the AST for the benefit of guest language programmers using tools; it might appear, for example in the context of a stack dump or trace and is not expected to be called often. If the language does not provide such a description then null is returned.

This method is thread-safe.

Returns

String
No description.

Throws

DebugException
No description.
SourceSection getSourceSection()

getSourceSection

since 0.17
public SourceSection getSourceSection()

Returns the source section of the location where the debugging session was suspended. The source section is null if the source location is not available.

This method is thread-safe.

Returns

SourceSection
No description.
LanguageInfo getLanguage()

getLanguage

since 19.0
public LanguageInfo getLanguage()

Returns public information about the language of this frame.

Returns

LanguageInfo
the language info, or null when no language is associated with this frame.
DebugScope getScope()

getScope

since 0.26
public DebugScope getScope() throws DebugException

Get the current inner-most scope. The scope remain valid as long as the current stack frame remains valid.

Use DebuggerSession.getTopScope(java.lang.String) to get scopes with global validity.

This method is not thread-safe and will throw an IllegalStateException if called on another thread than it was created with.

Returns

DebugScope
the scope, or null when no language is associated with this frame location, or when no local scope exists.

Throws

DebugException
when guest language code throws an exception
Node getRawNode(Class<? extends TruffleLanguage<?>>)

getRawNode

since 20.1
public Node getRawNode(Class<? extends TruffleLanguage<?>> languageClass)

Returns the current node for this stack frame, or null if the requesting language class does not match the root node guest language. This method is permitted only if the guest language class is available. This is the case if you want to utilize the Debugger API directly from within a guest language, or if you are an instrument bound/dependent on a specific language.

Parameters

languageClassClass<? extends TruffleLanguage<?>>
the Truffle language class for a given guest language

Returns

Node
the node associated with the frame
Frame getRawFrame(Class<? extends TruffleLanguage<?>>, FrameInstance.FrameAccess)

getRawFrame

since 20.1
public Frame getRawFrame(
    Class<? extends TruffleLanguage<?>> languageClass,
    FrameInstance.FrameAccess access
)

Returns the underlying frame for this debug stack frame or null if the requesting language class does not match the root node guest language. This method is permitted only if the guest language class is available. This is the case if you want to utilize the Debugger API directly from within a guest language, or if you are an instrument bound/dependent on a specific language.

Parameters

languageClassClass<? extends TruffleLanguage<?>>
the Truffle language class for a given guest language
accessFrameInstance.FrameAccess
the frame access mode

Returns

Frame
the frame
DebugValue eval(String)

eval

since 0.17
public DebugValue eval(String code) throws DebugException

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.

This method is not thread-safe and will throw an IllegalStateException if called on another thread than it was created with.

Parameters

codeString
the code to evaluate

Returns

DebugValue
the return value of the expression

Throws

DebugException
when guest language code throws an exception
IllegalStateExceptionunchecked
if called on another thread than this frame was created with, or if language of this frame is not interactive.
boolean equals(Object)Described in equals(java.lang.Object).

equals

since 19.0
public boolean equals(Object obj)

Described in equals(java.lang.Object).

Parameters

objObject
No description.

Returns

boolean
No description.
int hashCode()Described in hashCode().

hashCode

since 19.0
public int hashCode()

Described in hashCode().

Returns

int
No description.

Inherited members