How to native debug Java on macOS?
alexandr.miloslavskiy at gmail.com
Mon Sep 9 16:04:50 UTC 2019
For a while now, I've been working on solving native JVM crashes in a
third party library with lots on JNI. Some turn out to be library bugs,
some are JVM bugs, some are OS bugs. Anyways, that involves a lot of
work with a native debugger, such as WinDBG / GDB / LLDB.
Native-debugging JVM is harder then usual, because JVM raises lots of
exceptions for internal purposes, and I have to skip them in my
debugger. Eventually, I devised scripts for WinDBG (Windows) and GDB
(Linux) to auto-skip those exceptions.
However, on macOS, it seems that LLDB debugger is unable to pass
EXC_BAD_ACCESS down to application and instead get stuck on it. I spent
a while and managed to get GDB running on macOS, but ran into other
difficulties where GDB is unable to load debugging information for
system libraries. I also think that in general, GDB is not very
feature-reach in terms of macOS specific stuff.
I also tried to disable those internal exceptions in JVM, but it seems
that it can't be done any easily.
So... How do you guys native-debug on macOS?
More information about the hotspot-dev