跟踪java字节码流 [英] Trace java bytecode stream

查看:348
本文介绍了跟踪java字节码流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望看到它正在执行的JVM的当前(字节码)指令流。经过一些googleing,我发现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.


  1. 从OpenJDK 8项目克隆热点存储库

  1. 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字节码流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆