`

jvm运行期打印汇编信息

    博客分类:
  • j2se
 
阅读更多

如果只在jvm参数中加入-XX:+PrintAssembly参数,运行报错:

Java代码  收藏代码
  1. Improperly specified VM option 'PrintAssembly'  
  2. Error: Could not create the Java Virtual Machine.  
  3. Error: A fatal exception has occurred. Program will exit.  

         同时加上-XX:+UnlockDiagnosticVMOptions则可以打印编译信息,并且这个参数必须放在PrintAssembly前面才行。不过MacOSX上加了之后又遇到了新的错误:

Java代码  收藏代码
  1. VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output  
  2. Could not load hsdis-amd64.dylib; library not loadable; PrintAssembly is disabled  

         按照这里下载hsdis-am64.dylib,放到你自己的目录下,如/xxx/yyy/zzz/,并chmod 设置当前用户可执行,然后在~/.bash_profile加上一行:

Java代码  收藏代码
  1. #这里只能设置到目录一级,不能设置到dylib文件  
  2. export LD_LIBRARY_PATH=/xxx/yyy/zzz/  

         注销重新登陆,重新运行程序,汇编信息就打印出来了。

        enjoy it!

 

http://yueyemaitian.iteye.com/blog/2042772

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics