Package com.oracle.truffle.api.debug
Class DebugException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.oracle.truffle.api.debug.DebugException
- All Implemented Interfaces:
Serializable
Information about an exception thrown from a guest language. This exception does not contain a
Java stack trace, use
getDebugStackTrace()
to find out the guest language stack trace.
Debugger methods that run guest language code may throw this exception.
- Since:
- 19.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents an exception catch location. -
Method Summary
Modifier and TypeMethodDescriptionUnsupported,DebugException
instances are not writable therefore filling the stack trace has no effect for them.Get source code location where this exception is to be caught.Get a list of asynchronous stack traces that led to scheduling of the exception's execution.Gets stack trace elements of guest languages.Get a guest language object representing the exception, if any.getRawException
(Class<? extends TruffleLanguage<?>> languageClass) Returns the guest language representation of the exception, ornull
if the requesting language class does not match the root node language at the throw location.Gets stack trace elements of guest languages.Get source code location where this exception was thrown from.boolean
Returnstrue
if this exception indicates an internal error.void
void
void
void
setStackTrace
(StackTraceElement[] stackTrace) Unsupported,DebugException
instances are not writable therefore setting the stack trace has no effect for them.Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getMessage, getSuppressed, initCause, toString
-
Method Details
-
fillInStackTrace
Unsupported,DebugException
instances are not writable therefore filling the stack trace has no effect for them.- Overrides:
fillInStackTrace
in classThrowable
- Since:
- 19.0
-
setStackTrace
Unsupported,DebugException
instances are not writable therefore setting the stack trace has no effect for them.- Overrides:
setStackTrace
in classThrowable
- Since:
- 19.0
-
getStackTrace
Gets stack trace elements of guest languages. It is recommended to usegetDebugStackTrace()
as the guest language stack elements do not always fit the Java format for stack trace elements.- Overrides:
getStackTrace
in classThrowable
- Since:
- 19.0
-
getDebugStackTrace
Gets stack trace elements of guest languages.- Since:
- 19.0
-
getDebugAsynchronousStacks
Get a list of asynchronous stack traces that led to scheduling of the exception's execution. Returns an empty list if no asynchronous stack is known. The first asynchronous stack is at the first index in the list. A possible next asynchronous stack (that scheduled execution of the previous one) is at the next index in the list.Languages might not provide asynchronous stack traces by default for performance reasons. Call
DebuggerSession.setAsynchronousStackDepth(int)
to request asynchronous stacks. Languages may provide asynchronous stacks if it's of no performance penalty, or if requested by other options.- Since:
- 20.1.0
- See Also:
-
printStackTrace
public void printStackTrace()- Overrides:
printStackTrace
in classThrowable
- Since:
- 19.0
-
printStackTrace
- Overrides:
printStackTrace
in classThrowable
- Since:
- 19.0
-
printStackTrace
- Overrides:
printStackTrace
in classThrowable
- Since:
- 19.0
-
isInternalError
public boolean isInternalError()Returnstrue
if this exception indicates an internal error.- Since:
- 19.0
-
getExceptionObject
Get a guest language object representing the exception, if any.- Returns:
- an exception object, or
null
- Since:
- 19.0
-
getThrowLocation
Get source code location where this exception was thrown from.- Returns:
- the thrown location, or
null
when the thrown location is not known. - Since:
- 19.0
-
getCatchLocation
Get source code location where this exception is to be caught. In case this exception is going to be caught by guest language code, the catch location is provided.null
is returned for uncaught exceptions.- Returns:
- the catch location, or
null
in case of uncaught exceptions. - Since:
- 19.0
-
getRawException
Returns the guest language representation of the exception, ornull
if the requesting language class does not match the root node language at the throw location. 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:
languageClass
- the Truffle language class for a given guest language- Returns:
- the throwable guest language exception object
- Since:
- 20.1
-