public final class JavaStackWalker extends Object
StackFrameVisitor to each of the Java frames in a thread stack. It skips native
frames, i.e., it only visits frames where Java frame
information is available.
The stack walking code is allocation free (so that it can be used during garbage collection) and stateless (so that multiple threads can walk their stacks concurrently).
| Modifier and Type | Method and Description |
|---|---|
static boolean |
continueWalk(JavaStackWalk walk)
Continue a started stack walk.
|
static boolean |
initWalk(JavaStackWalk walk,
org.graalvm.nativeimage.IsolateThread thread)
Initialize a stack walk for the given thread.
|
static boolean |
initWalk(JavaStackWalk walk,
org.graalvm.word.Pointer startSP,
org.graalvm.nativeimage.c.function.CodePointer startIP)
Initialize a stack walk for the current thread.
|
static boolean |
walkCurrentThread(org.graalvm.word.Pointer startSP,
org.graalvm.nativeimage.c.function.CodePointer startIP,
StackFrameVisitor visitor) |
static boolean |
walkThread(org.graalvm.nativeimage.IsolateThread thread,
StackFrameVisitor visitor) |
public static boolean initWalk(JavaStackWalk walk, org.graalvm.word.Pointer startSP, org.graalvm.nativeimage.c.function.CodePointer startIP)
walk parameter should
normally be allocated on the stack.
The stack walker is only valid while the stack being walked is stable and existent.
walk - the stack-allocated walk base pointerstartSP - the starting SPstartIP - the starting IPpublic static boolean initWalk(JavaStackWalk walk, org.graalvm.nativeimage.IsolateThread thread)
walk parameter should
normally be allocated on the stack.walk - the stack-allocated walk base pointerthread - the thread to examinepublic static boolean continueWalk(JavaStackWalk walk)
JavaStackWalker.initWalk(com.oracle.svm.core.stack.JavaStackWalk, org.graalvm.word.Pointer, org.graalvm.nativeimage.c.function.CodePointer) was
called to start the walk. Once this method returns false, it will always return
false.walk - the initiated stack walk pointertrue if there is another frame, or false if there are no more frames
to iteratepublic static boolean walkCurrentThread(org.graalvm.word.Pointer startSP,
org.graalvm.nativeimage.c.function.CodePointer startIP,
StackFrameVisitor visitor)
public static boolean walkThread(org.graalvm.nativeimage.IsolateThread thread,
StackFrameVisitor visitor)