Share via


Thread.GetStackTrace Method

Definition

Returns an array of stack trace elements representing the stack dump of this thread.

[Android.Runtime.Register("getStackTrace", "()[Ljava/lang/StackTraceElement;", "GetGetStackTraceHandler")]
public virtual Java.Lang.StackTraceElement[] GetStackTrace ();
[<Android.Runtime.Register("getStackTrace", "()[Ljava/lang/StackTraceElement;", "GetGetStackTraceHandler")>]
abstract member GetStackTrace : unit -> Java.Lang.StackTraceElement[]
override this.GetStackTrace : unit -> Java.Lang.StackTraceElement[]

Returns

an array of StackTraceElement, each represents one stack frame.

Attributes

Remarks

Returns an array of stack trace elements representing the stack dump of this thread. This method will return a zero-length array if this thread has not started, has started but has not yet been scheduled to run by the system, or has terminated. If the returned array is of non-zero length then the first element of the array represents the top of the stack, which is the most recent method invocation in the sequence. The last element of the array represents the bottom of the stack, which is the least recent method invocation in the sequence.

If there is a security manager, and this thread is not the current thread, then the security manager's checkPermission method is called with a RuntimePermission("getStackTrace") permission to see if it's ok to get the stack trace.

Some virtual machines may, under some circumstances, omit one or more stack frames from the stack trace. In the extreme case, a virtual machine that has no stack trace information concerning this thread is permitted to return a zero-length array from this method.

Added in 1.5.

Java documentation for java.lang.Thread.getStackTrace().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to