Creating breakpoints via filename and line number does not work (or I’m doing it wrong). I.e. -f main.ml -l 1 does not resolve to a valid breakpoint.
I can set breakpoints via -n camlMain__printSum_xxx (where xxx is some number) or via regex -r camlMain\.printSum* on newer versions of OCaml (due to the name mangling bug).
When a breakpoint is hit, no source code is available, only assembler (list also does not work). I assume that is connected to the first issue as well.
Am I doing something wrong? Is there an option I’m missing for ocamlopt?
No you are not doing anything wrong, that is the state of debugging with LLDB on MacOS.
So #13050 will restore setting breakpoints using the current name mangling scheme in 5.2 and will work nicely with tab complete in LLDB. It’s marked for 5.3 release so fingers crossed it makes it.
Setting breakpoints using filename and line number requires the compiler to output a small amount of DWARF information to associate symbols with source files, and OCaml structures like functions and modules with symbols. Without this you won’t see source code when you hit a breakpoint and list won’t work either. I’m actively working on a fix for this issue.
The problem on macOS with Mach-O binaries is the tooling expects a minimum amount of DWARF information to associate an object file with the pieces of source code used to build that binary. For OCaml purposes that is source file names, mapping from symbols to location ranges and some minimal Debugging Information Entry (abbreviated DIE) to tie everything together.
Awesome, thanks for the explanation! I was trying for hours with multiple local switches and different setups back to ocamldebug it is then (at least for the time being).
Over the next few months I expect to have an implementation for writing minimal DWARF such that setting breakpoints based on filename and line number works on macOS. Either that or #13050 will give a decent experience setting breakpoints.