我尝试按照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

最佳答案

C ++符号在二进制对象中为mangled。您将找不到minor_collection_beginvoid AdaptiveSizePolicy::minor_collection_begin()的错误的符号名称是

_ZN18AdaptiveSizePolicy22minor_collection_beginEv

关于java-8 - 如何使用uprobe跟踪OpenJDK HotSpot源代码?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48535366/

10-10 08:22