use of com.oracle.svm.jvmtiagentbase.jvmti.JvmtiLineNumberEntry in project graal by oracle.
the class JavaStackTraceCreator method getFrameSourceLineNumber.
private static int getFrameSourceLineNumber(JvmtiEnv jvmti, JvmtiFrameInfo frameInfo) {
CIntPointer entryCountPointer = StackValue.get(CIntPointer.class);
WordPointer lineEntryTablePointer = StackValue.get(WordPointer.class);
JvmtiError errorCode = jvmti.getFunctions().GetLineNumberTable().invoke(jvmti, frameInfo.getMethod(), entryCountPointer, lineEntryTablePointer);
if (errorCode == JvmtiError.JVMTI_ERROR_MUST_POSSESS_CAPABILITY || errorCode == JvmtiError.JVMTI_ERROR_ABSENT_INFORMATION) {
return LINE_NUMBER_UNAVAILABLE;
}
check(errorCode);
int entryCount = entryCountPointer.read();
Pointer lineEntryTable = lineEntryTablePointer.read();
VMError.guarantee(lineEntryTable.isNonNull());
int previousLineNumber = LINE_NUMBER_UNAVAILABLE;
for (int i = 0; i < entryCount; ++i) {
JvmtiLineNumberEntry entry = (JvmtiLineNumberEntry) lineEntryTable.add(i * SizeOf.get(JvmtiLineNumberEntry.class));
if (entry.getStartLocation() > frameInfo.getLocation()) {
break;
}
previousLineNumber = entry.getLineNumber();
}
jvmti.getFunctions().Deallocate().invoke(jvmti, lineEntryTable);
return previousLineNumber;
}
Aggregations