Trace java bytecode stream(跟踪 java 字节码流)
问题描述
我想查看它正在执行的 JVM 的当前(字节码)指令流.经过一番谷歌搜索,我发现 jvm 调试版本提供了 -XX:+TraceBytecodes 选项(参见 这里).但是,提到的热点 JVM 调试构建链接已失效,我无法在线找到调试构建:/
I would like to see the current (bytecode) instruction stream of the JVM it is executing. After some googleing, I found that the jvm debug build offers the -XX:+TraceBytecodesoption (see here). However, the mentioned link to the hotspot JVM debug build is dead and I could not find a debug build online :/
是否有另一种方法可以跟踪 jvm 字节码流,或者有人可以指出我正确的方向吗?我正在运行 64 位 ubuntu 16.04.
Is there another way to trace the jvm bytecode stream or can someone point me in the right direction? I'm running 64 bit ubuntu 16.04.
P.S:我知道,打印出完整的指令流会非常缓慢.不过,我是古玩
P.S: I know, its going to be painfully slow to print out the complete instruction stream. However, I am curios
推荐答案
-XX:+TraceBytecodes 选项正是您要找的.它在 HotSpot JVM 的调试版本中可用.您可以轻松地自己构建 JVM - 只是 HotSpot,甚至不是 JDK.
-XX:+TraceBytecodes option is exactly what are you looking for. It is available in debug builds of HotSpot JVM. You can easily build JVM yourself - just HotSpot, not even JDK.
从 OpenJDK 8 项目中克隆热点存储库
Clone hotspot repository from OpenJDK 8 project
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot
构建 'fastdebug' JVM(假设 JDK 已安装在 /usr/java/jdk1.8.0_102)
cd hotspot/make
make ALT_BOOTDIR=/usr/java/jdk1.8.0_102 ARCH_DATA_MODEL=64 fastdebug
您可以添加 HOTSPOT_BUILD_JOBS=N 以在 N 个并行进程中运行编译.
You may add HOTSPOT_BUILD_JOBS=N to run compilation in N parallel processes.
运行它
export ALT_JAVA_HOME=/usr/java/jdk1.8.0_102
../build/linux/linux_amd64_compiler2/fastdebug/hotspot -XX:+TraceBytecodes MainClass
这篇关于跟踪 java 字节码流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:跟踪 java 字节码流
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
