如何使用uprobe跟踪OpenJDK HotSpot源代码?

时间:2018-01-31 05:54:49

标签: java-8 openjdk jvm-hotspot

我尝试按照link

的说明操作

在此example中,

Tracing func_abc() in my test program, and including user-level stacks:

# ./uprobe -s p:/root/func_abc:func_c
Tracing uprobe func_c (p:func_c /root/func_abc:0x4f4). Ctrl-C to end.
        func_abc-25394 [000] d... 19603250.054040: func_c: (0x4004f4)
        func_abc-25394 [000] d... 19603250.054056: <user stack trace>
 =>  <00000000004004f4>
 =>  <0000000000400527>
 =>  <0000000000400537>
 =>  <00007fca9f0e376d>
        func_abc-25394 [000] d... 19603251.054250: func_c: (0x4004f4)
        func_abc-25394 [000] d... 19603251.054266: <user stack trace>
 =>  <00000000004004f4>
 =>  <0000000000400527>
 =>  <0000000000400537>
 =>  <00007fca9f0e376d>
^C
Ending tracing...

我想探究函数minor_collection_begin,但它显示ERROR: missing symbol

root@wxf:/home/wxf/perf-tool/perf-tools/bin# ./uprobe -s p:/home/wxf/9dev/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java:AdaptiveSizePolicy::minor_collection_begin
ERROR: missing symbol "minor_collection_begin" in /home/wxf/9dev/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java
root@wxf:/home/wxf/perf-tool/perf-tools/bin# ./uprobe -s p:/home/wxf/9dev/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java:minor_collection_begin
ERROR: missing symbol "minor_collection_begin" in /home/wxf/9dev/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java

我搜索了很多,发现它与libjvm.so有关。但是,我不知道下一步该做什么。

wxf@wxf:/home/wxf/adjustableMaxHeapSize_9jdk_prj/9dev$ find -name "libjvm.so"
./build/linux-x86_64-normal-server-slowdebug/support/modules_libs/java.base/server/libjvm.so
./build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/gtest/libjvm.so
./build/linux-x86_64-normal-server-slowdebug/jdk/lib/server/libjvm.so

1 个答案:

答案 0 :(得分:1)

二进制对象中的C ++符号为mangled。你找不到minor_collection_beginvoid AdaptiveSizePolicy::minor_collection_begin()的错位符号名称为

_ZN18AdaptiveSizePolicy22minor_collection_beginEv