Enable systemtap jni tracing

Mark Wielaard mark at klomp.org
Wed Oct 14 06:43:00 PDT 2009


There were two issues preventing systemtap tracing of JNI methods. The
first was an issue with the systemtap sdt.h probe points not working for
c++ class constructors/destructors. The second was that some JNI macros
were using some dtrace implementation tricks instead of using the
standard dtrace macros.

This patch first adds a configure check to see that there is a recent
enough systemtap sdt.h (0.9.9+ is fine) and a recent enough g++ for
compiling the result. I don't exactly know when g++ was fixed, but gcc
4.1 is too old, while gcc 4.4 is fine. For this reason I wrote a feature
check that actually compiles and links a little program to make sure
everything works as intended. Secondly it cleans up jni.cpp so that the
two macros that used dtrace function calls now use DTRACE_PROBE macros
instead so it works as is against either dtrace or systemtap. It also
enables the last disabled hotspot.monitor_notify probe in the tapset
that now always works (given a newer stap and g++).

2009-10-14  Mark Wielaard  <mjw at redhat.com>

        * configure.ac: When enabling systemtap support check sys/sdt.h
        and g++ are recent enough to allow probes in class constructors
        and destructors.
        * patches/icedtea-systemtap.patch: Enable compiling probes in
        jni.cpp. Rewrite Set<prim>Field and SetStatic<prim>Field macros
        to use DTRACE_PROBE interface directly instead of generating
        dtrace implementation calls. Clean up dtrace.hpp.
        * tapset/hotspot.stp.in: Enable hotspot.monitor_notify. Fix up

I'll provide a jni tapset soon for more powerful tracing. But the above
will enable you to use "raw" probe
process("...path/to/libjvm.so").mark("*") already to see all the JNI
interactions your program has.

Commited and Pushed,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemtap-jni.patch
Type: text/x-patch
Size: 7705 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20091014/d5b9dbb1/systemtap-jni.patch 

More information about the distro-pkg-dev mailing list