有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

调试如何从核心文件打印java端的堆栈跟踪

<>我有一个C++程序,它使用JNI来启动JVM并运行java代码。但是现在程序崩溃了,生成了一个核心文件

当我通过`gdb<;我的_计划>,仅显示顶部的两个框架,其他框架为

(gdb) bt
#0  0x00007f635bf98596 in __memmove_avx_unaligned () from /var/lib/jenkins/Projects/libc.so.6
#1  0x00007f634aa1d142 in Unsafe_CopyMemory0 () from /RELEASE/BIN/Linux/_jre/lib/server/libjvm.so
#2  0x00007f63285c20a4 in ?? ()
#3  0x00000000000014ea in ?? ()
#4  0x00000000b5330948 in ?? ()
#5  0x0000000000000000 in ?? ()

我想那些??如果是java堆栈跟踪,我尝试使用jstack <my_program> <core>打印它们,但错误如下

Error: More than one non-option argument
Cannot connect to the core dump or remote debug server. Use jhsdb jstack instead

我还尝试了jhsdb jstack --exe <my_pogram> --core <core>,但得到了以下错误

Error attaching to core file: Can't attach to the core file
sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the core file
        at jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
        at jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:282)
        at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:674)
        at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:612)
        at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:338)
        at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
        at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:157)
        at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
        at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90)
        at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:297)
        at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:533)

有没有办法把这些打印出来??镜框


共 (0) 个答案