我们最近遇到了一个JVM崩溃,留下了gcore命令生成的核心转储文件.我们想看一下文件的内容,找出导致崩溃的确切原因.
使用该jmap命令,您应该能够将核心转储文件转换为hprof文件格式的文件,然后可以使用VisualVM和许多其他工具进行分析.我试过这个并收到错误消息.这是我运行的命令(在发生崩溃的同一个框中,使用相同的JVM):
jmap -dump:format=b,file=dump.hprof /usr/java/jdk1.6.0_16/bin/java core.dump.2878
Run Code Online (Sandbox Code Playgroud)
整个回应是:
> Attaching to core core.dump.8483 from executable /usr/java/jdk1.6.0_16/bin/java, please wait...
> Error attaching to core file: Can't attach to the core file
Run Code Online (Sandbox Code Playgroud)
这不是一个非常有用的错误消息.我想知道它是否是一个权限问题,但是我得到了运行该命令的相同消息,就像运行导致核心转储的JVM一样.我也想知道核心文件是否已损坏,所以我决定用它gdb来查看我是否可以打开核心文件并查看其中的内容.这就是我得到的:
> gdb GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1) License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for …