getStackForCallerOf

public static Array<StackTraceElement> getStackForCallerOf(Class<? extends Object> target, int maxDepth, int skip)

Returns a synthetic stack trace starting at the immediate caller of the specified target.

Return

a synthetic stack trace starting at the immediate caller of the specified target, or the empty array if no caller was found (due to incorrect target, wrong skip count or use of JNI).

Parameters

target

the class who caller the returned stack trace will start at.

maxDepth

the maximum size of the returned stack (pass -1 for the complete stack).

skip

the minimum number of stack frames to skip before looking for callers.