Let's say I:
dune init proj foobar
cd foobar
Then modify test/test_foobar.ml
to be:
let () = print_endline "First"
let () = print_endline "Second"
let () = print_endline "Third"
I can execute the program with dune test
.
How can I run the program and step each line individually in a debugger with source available?
Either ocamldebug
or gdb
is probably fine.
I can do gdb --tui --args ./_build/default/test/test_foobar.exe
but it does NOT show the source.
I don't see any suitable files to launch with ocamldebug
e.g.:
$ ocamldebug ./_build/default/test/test_foobar.ml
OCaml Debugger version 5.2.0
(ocd) r
Loading program... < shortened >/foobar/./_build/default/test/test_foobar.ml is not a bytecode file.
Working with OCaml 5.2.0 and dune 3.15.3