I want to get the Assembly code for the jitted code to get the parameters value based on the Java calling convention. Suppose the JVM is hotspot, the platform is Linux 64 bit , and we have the following caller and calle, and I want to check the parameters passed to callee from the JVM core dump.
protected void caller( ) {
callee(1,"123", 123,1);
}
protected void callee(int a,String b, Integer c,Object d) {
Thread.sleep(11111111);
}
Run Code Online (Sandbox Code Playgroud)
Based on the following Java calling convention, we know we can get the parameters from the Registers, such as up to 6 first integer arguments are passed in registers: rsi, rdx, rcx, r8, r9, rdi http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/b4bdf3484720/src/cpu/x86/vm/assembler_x86.hpp#l91
For the c/c++ method, and we can use the gdb just through the way by printting call stack by the command backtrace , then frame N(N is the thread number), then x/20i $pc-64 to get the assembly code, and we can get the value from the related frame context Register. However the Java method call stack can not be printed from gdb, and we don't know the frame number, then we cannot use the same way like c/c++ to get the assembly code,so how to check the assembly code for the Java jitted method from the core dump?
PS, Someone mentioned the PrintOptoAssembly, however I need the Assembly code to get the parameters value from the registers by calling convention(such as by backtrace , then frame N , then x/20i $pc-64 through gdb) not just the Assembly code only.
使用 gdb 命令您不会看到 Java 框架backtrace。但是,您不需要手动从核心转储中提取虚拟机结构 - 有更好的选择。
Serviceability Agent是专门为分析 Java 进程内存或核心转储而设计的工具。它具有标准 JDK 包中提供的Java API 。sa-jdi.jar
下面是一个使用局部变量信息打印扩展 Java 堆栈跟踪的示例。它还可以解析核心转储。
HotSpot JVM 的调试版本包括可以从 gdb 调用的特殊调试函数。例如
psf()打印堆栈帧;pfl()打印框架布局;disnm(intptr_t addr)在给定地址反汇编已编译的 Java 方法;pp(intptr_t addr)打印给定地址处的 Java 对象;这些功能在调试活动进程时起作用;但不适合核心转储。
顺便说一句,这是一个自行构建 JVM 调试版本的快速指南。
| 归档时间: |
|
| 查看次数: |
450 次 |
| 最近记录: |