Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.06 KB

File metadata and controls

62 lines (42 loc) · 2.06 KB

Interoperability with JVM Targets (Java, Kotlin)

This document describes the minimum setup needed to debug JVM processes that call into native code generated by this project.

Debugging on macOS

Prerequisites:

  • Unsigned Java runtime (signed builds will simply not let LLDB attach to the JVM process)
  • LLDB installed

Procedure:

  1. Launch the JVM application as usual (with or without your standard Java/Kotlin debugger).

  2. Before attaching LLDB, export an additional debugserver argument to prevent LLDB from masking signals:

    export LLDB_DEBUGSERVER_EXTRA_ARG_1=--unmask-signals
  3. Attach LLDB to the running JVM process and disable the macOS EXC_BAD_ACCESS trap:

    settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_ACCESS
    

    Background: llvm/llvm-project#60438

  4. 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