diff options
author | Keith Seitz <keiths@redhat.com> | 2006-10-28 02:15:12 +0000 |
---|---|---|
committer | Keith Seitz <kseitz@gcc.gnu.org> | 2006-10-28 02:15:12 +0000 |
commit | f356a436f04c20db31d307e2e31e4dab21d0543b (patch) | |
tree | f282f5ddea71f48497a4039392fed5ec28964f5a /libjava/stacktrace.cc | |
parent | 62baeb4f013e6f0a682f043dbd8720a558dec462 (diff) | |
download | gcc-f356a436f04c20db31d307e2e31e4dab21d0543b.zip gcc-f356a436f04c20db31d307e2e31e4dab21d0543b.tar.gz gcc-f356a436f04c20db31d307e2e31e4dab21d0543b.tar.bz2 |
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
Diffstat (limited to 'libjava/stacktrace.cc')
-rw-r--r-- | libjava/stacktrace.cc | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libjava/stacktrace.cc b/libjava/stacktrace.cc index 7f967ba..77a2864 100644 --- a/libjava/stacktrace.cc +++ b/libjava/stacktrace.cc @@ -23,7 +23,6 @@ details. */ #include <java/lang/Long.h> #include <java/security/AccessController.h> #include <java/util/ArrayList.h> -#include <java/util/IdentityHashMap.h> #include <gnu/classpath/jdwp/Jdwp.h> #include <gnu/java/lang/MainThread.h> #include <gnu/gcj/runtime/NameFinder.h> @@ -41,7 +40,7 @@ using namespace gnu::gcj::runtime; // NOTE: Currently this Map contradicts class GC for native classes. This map // (and the "new class stack") will need to use WeakReferences in order to // enable native class GC. -static java::util::IdentityHashMap *ncodeMap; +java::util::IdentityHashMap *_Jv_StackTrace::ncodeMap; // Check the "class stack" for any classes initialized since we were last // called, and add them to ncodeMap. @@ -56,21 +55,20 @@ _Jv_StackTrace::UpdateNCodeMap () jclass klass; while ((klass = _Jv_PopClass ())) - if (!_Jv_IsInterpretedClass (klass)) - { - //printf ("got %s\n", klass->name->data); - for (int i = 0; i < klass->method_count; i++) - { - _Jv_Method *method = &klass->methods[i]; - void *ncode = method->ncode; - // Add non-abstract methods to ncodeMap. - if (ncode) - { - ncode = UNWRAP_FUNCTION_DESCRIPTOR (ncode); - ncodeMap->put ((java::lang::Object *) ncode, klass); - } - } - } + { + //printf ("got %s\n", klass->name->data); + for (int i = 0; i < klass->method_count; i++) + { + _Jv_Method *method = &klass->methods[i]; + void *ncode = method->ncode; + // Add non-abstract methods to ncodeMap. + if (ncode) + { + ncode = UNWRAP_FUNCTION_DESCRIPTOR (ncode); + ncodeMap->put ((java::lang::Object *) ncode, klass); + } + } + } } // Given a native frame, return the class which this code belongs @@ -85,7 +83,13 @@ _Jv_StackTrace::ClassForFrame (_Jv_StackFrame *frame) // look it up in ncodeMap if (frame->start_ip) - klass = (jclass) ncodeMap->get ((jobject) frame->start_ip); + { + klass = (jclass) ncodeMap->get ((jobject) frame->start_ip); + + // Exclude interpreted classes + if (klass != NULL && _Jv_IsInterpretedClass (klass)) + klass = NULL; + } return klass; } |