JVMTI stack tracing patch breaks C++ ABI

David Daney ddaney@avtrex.com
Wed Sep 19 21:31:00 GMT 2007


Keith Seitz wrote:
> Hi,
> 
> Mark discovered today that the following JDWP patch:
> 
> 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.
> 
> breaks the C++ ABI by adding a new field to Thread.java. So I presume 
> this should be fixed?

I don't think so.  There is no C++ ABI compatibility across GCC 
releases.  This should be fine as is.

If you want compatibility, use indirect dispatch.

> 
> Does adding something to struct natThread to do this sound like a 
> reasonable plan? Or we could simply hold around a hashtable which maps 
> java.lang.Thread to their corresponding frame pointers.

N/A I think.  See above.

David Daney



More information about the Java mailing list