diff options
author | Kyle Galloway <kgallowa@redhat.com> | 2007-01-29 22:05:56 +0000 |
---|---|---|
committer | Kyle Galloway <kgallowa@gcc.gnu.org> | 2007-01-29 22:05:56 +0000 |
commit | 392731311776d30b0910e51a5bc2aef070a9fc8b (patch) | |
tree | 832133e3bfa83e14520e76d3a01b7a61b1b3b20e /libjava/include | |
parent | d75bf843440e5d372411699e81d87b273d398da6 (diff) | |
download | gcc-392731311776d30b0910e51a5bc2aef070a9fc8b.zip gcc-392731311776d30b0910e51a5bc2aef070a9fc8b.tar.gz gcc-392731311776d30b0910e51a5bc2aef070a9fc8b.tar.bz2 |
java-interp.h: Added _Jv_Frame class and its two subclasses _Jv_InterpFrame and _Jv_NativeFrame.
2007-01-29 Kyle Galloway <kgallowa@redhat.com>
* include/java-interp.h: Added _Jv_Frame class and its two
subclasses _Jv_InterpFrame and _Jv_NativeFrame. Also moved
_Jv_FrameType from java-stack.h.
* include/java-stack.h: Removed _Jv_FrameType.
* java/lang/Thread.java: Added frame member to hold new
composite frame stack.
* java/lang/Thread.h: Regenerated.
* java/lang/Thread.class: Rebuilt.
* jni.cc (_Jv_JNIMethod::call): Push a frame onto the stack when
calling a JNI method.
* jvmti.cc (_Jv_JVMTI_GetStackTrace): New Method.
(_Jv_JVMTI_GetFrameCount): New method.
* stacktrace.cc (UnwindTraceFn): Modified to use new _Jv_Frame
classes.
* testsuite/libjava.jvmti/interp/getstacktrace.jar: New test.
* testsuite/libjava.jvmti/interp/natgetstacktrace.cc: New test.
* testsuite/libjava.jvmti/interp/getstacktrace.h: New test.
* testsuite/libjava.jvmti/interp/getstacktrace.jar: New test.
* testsuite/libjava.jvmti/interp/getstacktrace.out: Output file
for test.
From-SVN: r121314
Diffstat (limited to 'libjava/include')
-rw-r--r-- | libjava/include/java-interp.h | 79 | ||||
-rw-r--r-- | libjava/include/java-stack.h | 7 |
2 files changed, 65 insertions, 21 deletions
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h index 3b15b5c..3a43977 100644 --- a/libjava/include/java-interp.h +++ b/libjava/include/java-interp.h @@ -205,11 +205,11 @@ class _Jv_InterpMethod : public _Jv_MethodBase // number info is unavailable. int get_source_line(pc_t mpc); + public: + // Convenience function for indexing bytecode PC/insn slots in // line tables for JDWP jlong insn_index (pc_t pc); - - public: /* Get the line table for this method. * start is the lowest index in the method @@ -315,35 +315,86 @@ public: } }; -// The interpreted call stack, represented by a linked list of frames. -struct _Jv_InterpFrame +enum _Jv_FrameType { + frame_native, + frame_interpreter, + frame_proxy +}; + +// The composite call stack as represented by a linked list of frames +class _Jv_Frame +{ +public: + java::lang::Thread *thread; + union { + _Jv_MethodBase *self; void *meth; - _Jv_InterpMethod *self; _Jv_Method *proxyMethod; }; - java::lang::Thread *thread; - _Jv_InterpFrame *next; + + //The full list of frames, JNI and interpreted + _Jv_Frame *next; + _Jv_FrameType frame_type; + + _Jv_Frame (_Jv_MethodBase *s, java::lang::Thread *thr, _Jv_FrameType type) + { + self = s; + frame_type = type; + next = (_Jv_Frame *) thr->frame; + thr->frame = (gnu::gcj::RawData *) this; + thread = thr; + } + + ~_Jv_Frame () + { + thread->frame = (gnu::gcj::RawData *) next; + } +}; + +// An interpreted frame in the call stack +class _Jv_InterpFrame : public _Jv_Frame +{ +public: + + // Keep the purely interpreted list around so as not to break backtraces + _Jv_InterpFrame *next_interp; + union { pc_t pc; jclass proxyClass; }; - - _Jv_InterpFrame (void *meth, java::lang::Thread *thr, jclass proxyClass = NULL) + + //Debug info for local variables. + _Jv_word *locals; + char *locals_type; + + _Jv_InterpFrame (void *meth, java::lang::Thread *thr, jclass proxyCls = NULL) + : _Jv_Frame (reinterpret_cast<_Jv_MethodBase *> (meth), thr, + frame_interpreter) { - this->meth = meth; - thread = thr; - next = (_Jv_InterpFrame *) thr->interp_frame; + next_interp = (_Jv_InterpFrame *) thr->interp_frame; + proxyClass = proxyCls; thr->interp_frame = (gnu::gcj::RawData *) this; - this->proxyClass = proxyClass; } ~_Jv_InterpFrame () { - thread->interp_frame = (gnu::gcj::RawData *) next; + thread->interp_frame = (gnu::gcj::RawData *) next_interp; + } +}; + +// A native frame in the call stack really just a placeholder +class _Jv_NativeFrame : public _Jv_Frame +{ +public: + + _Jv_NativeFrame (_Jv_JNIMethod *s, java::lang::Thread *thr) + : _Jv_Frame (s, thr, frame_native) + { } }; diff --git a/libjava/include/java-stack.h b/libjava/include/java-stack.h index d4d63d7..49e6841 100644 --- a/libjava/include/java-stack.h +++ b/libjava/include/java-stack.h @@ -41,13 +41,6 @@ extern "Java" } } -enum _Jv_FrameType -{ - frame_native, - frame_interpreter, - frame_proxy -}; - #ifdef INTERPRETER struct _Jv_InterpFrameInfo { |