java-stack.h (ncodeMap): Declare.

* include/java-stack.h (ncodeMap): Declare.
        (_Jv_StackTrace): Make _Jv_GetMethodDeclaringClass friend.
        * java/lang/Class.h (_Jv_GetMethodDeclaringClass): Declare.
        * java/lang/natClass.cc (_Jv_GetMethodDeclaringClass): New
        function.
        * stacktrace.cc (ncodeMap): Redefine from file global to global
        for class _Jv_StackTrace.
        (_Jv_StackTrace::UpdateNCodeMap): Add interpreted classes, too,
        so that _Jv_GetMethodDeclaringClass can find them all.
        (_Jv_StackTrace::ClassForFrame): Exclude interpreted classes.
        * jvmti.cc (_Jv_JVMTI_GetMethodDeclaringClass): New function.
        (_Jv_JVMTI_Interface): Define GetMethodDeclaringClass function.

From-SVN: r118100
This commit is contained in:
Keith Seitz 2006-10-28 02:15:12 +00:00 committed by Keith Seitz
parent 62baeb4f01
commit f356a436f0
6 changed files with 73 additions and 20 deletions

View file

@ -290,6 +290,10 @@ class java::io::VMObjectStreamClass;
void _Jv_sharedlib_register_hook (jclass klass);
/* Find the class that defines the given method. Returns NULL
if it cannot be found. Searches both interpreted and native
classes. */
jclass _Jv_GetMethodDeclaringClass (jmethodID method);
class java::lang::Class : public java::lang::Object
{

View file

@ -1267,3 +1267,12 @@ _Jv_GetClassNameUtf8 (jclass klass)
{
return klass->name;
}
jclass
_Jv_GetMethodDeclaringClass (jmethodID method)
{
_Jv_StackTrace::UpdateNCodeMap ();
jobject obj = reinterpret_cast<jobject> (method->ncode);
return reinterpret_cast<jclass> (_Jv_StackTrace::ncodeMap->get (obj));
}