Fwd: Debugging native code with Hotspot and GDB
This is related to my past posts on Debugging Into JNI Code from 42 days ago. I haven't tried it yet. I'm blogging about it so that I don't lose the link or the tip.
Roman Kennke: The last couple of hours I struggled to debug a segfault some JNI code of OpenJDK. I could not get GDB doing anything useful with Hotspot. Until I discovered the following very useful command line option:java -XX:OnError="gdb - %p" MyApplicationThis fires up gdb whenever an error occurs, and sets up all the libraries etc for debugging. Very nice. Ideally you do this using a debug build of OpenJDK, so get get as much useful information as possible.