Debugging native OCaml code used to be painful because the compiler didn’t emit DWARF data. LLDB had no idea where your source lines or variables were. With DWARF v5 support, the compiler now includes proper debug info — line mappings, symbols, and variable names — so LLDB can actually follow your code.
A small LLDB Python plug-in reads OCaml values at runtime and prints them in a readable form: lists, tuples, closures, strings, etc. It follows DWARF location lists to track where each variable lives and uses the runtime headers to decode them. The `p` and `ocaml_vars` commands work like normal LLDB commands but understand OCaml values.
It’s not complete yet (records and variants still show as tuples), but it makes debugging native OCaml code straightforward. You can finally set breakpoints by source, inspect locals, and understand what’s in memory without switching to disassembly.
Claude Sonnet 4.5 (Claude Code) wrote most of it with ChatGPT 5 (Codex) reviewing and Claude addressing issues in each review. Codex wrote the last 10% or so when Claude kept getting stuck.
I did not write a single line of code but carefully shepherded AI over the course of several days and kept it on the straight and narrow.
- AI: I need to keep track of variables moving across registers. This is too hard, let’s go shopping…
- Me: Hey, don’t any no shortcuts!
My work was just directing, shaping, cajoling and reviewing.
Debugging native OCaml code used to be painful because the compiler didn’t emit DWARF data. LLDB had no idea where your source lines or variables were. With DWARF v5 support, the compiler now includes proper debug info — line mappings, symbols, and variable names — so LLDB can actually follow your code.
A small LLDB Python plug-in reads OCaml values at runtime and prints them in a readable form: lists, tuples, closures, strings, etc. It follows DWARF location lists to track where each variable lives and uses the runtime headers to decode them. The `p` and `ocaml_vars` commands work like normal LLDB commands but understand OCaml values.
It’s not complete yet (records and variants still show as tuples), but it makes debugging native OCaml code straightforward. You can finally set breakpoints by source, inspect locals, and understand what’s in memory without switching to disassembly.
I didn't write a single line of code in this PR but I carefully shepherded it to completion over the several days.
It’s not where I obtained this PR but how.
Claude Sonnet 4.5 (Claude Code) wrote most of it with ChatGPT 5 (Codex) reviewing and Claude addressing issues in each review. Codex wrote the last 10% or so when Claude kept getting stuck.
I did not write a single line of code but carefully shepherded AI over the course of several days and kept it on the straight and narrow.
- AI: I need to keep track of variables moving across registers. This is too hard, let’s go shopping… - Me: Hey, don’t any no shortcuts!
My work was just directing, shaping, cajoling and reviewing.
How do you plan on maintaining the tool if you’re out of funds to run Claude Code?