public final class DebugScope extends Object
frame
is only valid as long as the associated frame
is valid and methods on such scope need to be called on the frame's thread.DebugStackFrame.getScope()
,
DebuggerSession.getTopScope(String)
Modifier and Type | Method and Description |
---|---|
DebugValue |
convertRawValue(Class<? extends TruffleLanguage<?>> languageClass,
Object rawValue)
Converts the value to a DebugValue, or returns
null if the requesting language
class does not match the root node guest language. |
DebugValue |
getDeclaredValue(String name)
Get a local variable declared in this scope by name.
|
Iterable<DebugValue> |
getDeclaredValues()
Get local variables declared in this scope, valid at the current suspension point.
|
String |
getName()
Get a human readable name of this scope.
|
DebugScope |
getParent()
Get a parent scope.
|
DebugValue |
getReceiver()
Get value that represents the receiver object of this scope.
|
DebugValue |
getRootInstance()
Get value that represents root instance of this scope.
|
SourceSection |
getSourceSection()
Get a source section representing this scope.
|
boolean |
isFunctionScope()
Test if this scope represents the function scope at the frame it was
obtained from . |
public String getName()
public DebugScope getParent() throws DebugException
null
.DebugException
- when guest language code throws an exceptionpublic boolean isFunctionScope()
obtained from
.public SourceSection getSourceSection() throws DebugException
null
when not available.DebugException
- when guest language code throws an exceptionpublic DebugValue getReceiver()
this
in Java or JavaScript and self
in Ruby, for
instance.
The returned value has a name that represents the receiver in the guest language. The scope
that represents the function
provide receiver object, if there is
one, other scopes do not provide it, unless they override it.
null
when there is no receiver
objectpublic DebugValue getRootInstance()
null
when no such value exists.public Iterable<DebugValue> getDeclaredValues() throws DebugException
parent
, to get values of variables declared in parent scope,
if any. The declared values do not contain a receiver
.
This method is not thread-safe and will throw an IllegalStateException
if called on
another thread than it was created with.
DebugException
- when guest language code throws an exceptionpublic DebugValue getDeclaredValue(String name) throws DebugException
parent
, to get value of a variable declared in parent scope, if any.
This method is not thread-safe and will throw an IllegalStateException
if called on
another thread than it was created with.
null
when no such value was found.DebugException
- when guest language code throws an exceptionpublic DebugValue convertRawValue(Class<? extends TruffleLanguage<?>> languageClass, Object rawValue)
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.
This method is opposite to DebugValue.getRawValue(Class)
where the raw guest language
value is obtained from the DebugValue.
Note that the rawValue
must be a valid Interop value. If not, the method throws
IllegalArgumentException.languageClass
- the Truffle language class for a given guest languagerawValue
- the raw valueIllegalArgumentException
- when rawValue
is not an Interop value