I am writing JVMTI code to profile Java programs, which mostly entails obtaining stack traces from random threads at fixed time intervals using the function AsyncGetCallTrace. Thus, I am able to obtain CallTrace structures, each of which contains an array of CallFrame structures, which contain data about individual frames in a stack trace. Specifically, these data consist of: jmethodID method_id (the ID of the java method where the frame is located), and: jint lineno (the BCI of the method in the .class file, as far as I understand the documentation). I cannot seem to find a way to convert this "lineno" into the corresponding source code line number using the JVMTI framework (see file jvmti.h, located in /usr/lib/jvm/java-6-sun/include, at least on Linux). In fact, even outside the JVMTI framework, the only thing I could find on the web so far was here: http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/classfile/LineNumberTable.html, but even this may not be doing what I would like, and requires additional installation, AND requires me to process the data, which was generated by C++ JMVTI code, using a separate Java program.
If anyone knows how to convert BCI to source code line numbers from within JVMTI (or even in any way), please help!
[If someone knows this field well, please let me know, since I have a few more questions to ask about the process.]