use of com.oracle.svm.jvmtiagentbase.jvmti.JvmtiError in project graal by oracle.
the class Support method getCallerMethod.
public static JNIMethodId getCallerMethod(int depth) {
JvmtiFrameInfo frameInfo = StackValue.get(JvmtiFrameInfo.class);
CIntPointer countPtr = StackValue.get(CIntPointer.class);
JvmtiError result = jvmtiFunctions().GetStackTrace().invoke(jvmtiEnv(), nullHandle(), depth, 1, (WordPointer) frameInfo, countPtr);
if (result == JvmtiError.JVMTI_ERROR_NONE && countPtr.read() == 1) {
return frameInfo.getMethod();
}
return nullPointer();
}
use of com.oracle.svm.jvmtiagentbase.jvmti.JvmtiError in project graal by oracle.
the class JavaStackTraceCreator method constructStackTraceElement.
private StackTraceElement constructStackTraceElement(JvmtiFrameInfo frameInfo) {
JNIObjectHandle declaringClass = Support.getMethodDeclaringClass(frameInfo.getMethod());
String methodName = Support.getMethodNameOr(frameInfo.getMethod(), "");
String declaringClassName = Support.getClassNameOr(jni, declaringClass, "", "");
CCharPointer isNativePtr = StackValue.get(CCharPointer.class);
String fileName = null;
int lineNumber = LINE_NUMBER_UNAVAILABLE;
JvmtiError errorCode = jvmti.getFunctions().IsMethodNative().invoke(jvmti, frameInfo.getMethod(), isNativePtr);
if (errorCode == JvmtiError.JVMTI_ERROR_NONE && isNativePtr.read() == 0) {
fileName = getSourceFileName(declaringClass);
lineNumber = getFrameSourceLineNumber(jvmti, frameInfo);
}
return new StackTraceElement(declaringClassName, methodName, fileName, lineNumber);
}
Aggregations