This document describes the minimum setup needed to debug JVM processes that call into native code generated by this project.
Prerequisites:
- Unsigned Java runtime (signed builds will simply not let LLDB attach to the JVM process)
- LLDB installed
Procedure:
-
Launch the JVM application as usual (with or without your standard Java/Kotlin debugger).
-
Before attaching LLDB, export an additional debugserver argument to prevent LLDB from masking signals:
export LLDB_DEBUGSERVER_EXTRA_ARG_1=--unmask-signals -
Attach LLDB to the running JVM process and disable the macOS EXC_BAD_ACCESS trap:
settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_ACCESSBackground: llvm/llvm-project#60438
-
Continue execution in LLDB and debug normally (breakpoints in native code, stack inspection, etc.).
If LLDB still stops on EXC_BAD_ACCESS immediately after attaching, verify that:
- the environment variable was set in the shell that started LLDB, and
- the JVM build is unsigned.
To make the exception setting persistent, add the following to ~/.lldbinit:
settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_ACCESS