如何使用uprobe追踪OpenJDK HotSpot源码?
How to use uprobe to trace OpenJDK HotSpot source code?
我尝试按照 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_begin
。 void AdaptiveSizePolicy::minor_collection_begin()
的错位符号名称是
_ZN18AdaptiveSizePolicy22minor_collection_beginEv
我尝试按照 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_begin
。 void AdaptiveSizePolicy::minor_collection_begin()
的错位符号名称是
_ZN18AdaptiveSizePolicy22minor_collection_beginEv