How do I debug Segfaults occurring in the JVM when it runs my code?

后端 未结 5 1023
青春惊慌失措
青春惊慌失措 2020-12-14 02:46

My Java application has started to crash regularly with a SIGSEGV and a dump of stack data and a load of information in a text file.

I have debugged C programs in gd

5条回答
  •  难免孤独
    2020-12-14 03:44

    The following will almost certainly be useless unless you have native code. However, here goes.

    1. Start java program in java debugger, with breakpoint well before possible sigsegv.
    2. Use the ps command to obtain the processid of java.
    3. gdb /usr/lib/jvm/sun-java6/bin/java processid
    4. make sure that the gdb 'handle' command is set to stop on SIGSEGV
    5. continue in the java debugger from the breakpoint.
    6. wait for explosion.
    7. Use gdb to investigate

    If you've really managed to make the JVM take a sigsegv without any native code of your own, you are very unlikely to make any sense of what you will see next, and the best you can do is push a test case onto a bug report.

提交回复
热议问题