After using OCaml for around 10 years it is still my favourite language, and it’s amazing how far ahead of other programming languages it remains to this day.
OCaml 4.01.0 was released on Thursday and I’m putting it into Fedora Rawhide over this weekend.
Debuginfo is now (partially) enabled. The OCaml code generator has produced good quality DWARF information for a while, and now you are able to debug OCaml programs in gdb under Fedora:
$ sudo debuginfo-install ocaml ocaml-findlib $ gdb /usr/bin/ocamlfind [...] Reading symbols from /usr/bin/ocamlfind... Reading symbols from /usr/lib/debug/usr/bin/ocamlfind.debug...done. done. (gdb) break frontend.ml:469 Breakpoint 1 at 0x432500: file frontend.ml, line 469. (gdb) run query findlib -l Starting program: /usr/bin/ocamlfind query findlib -l Breakpoint 1, camlFrontend__query_package_1199 () at frontend.ml:469 469 let query_package () = (gdb) bt #0 camlFrontend__query_package_1199 () at frontend.ml:469 #1 0x000000000043a4b4 in camlFrontend__main_1670 () at frontend.ml:2231 #2 0x000000000043aa86 in camlFrontend__entry () at frontend.ml:2283 #3 0x000000000042adc9 in caml_program () #4 0x00000000004834be in caml_start_program () #5 0x000000000048365d in __libc_csu_init () #6 0x0000003979821b75 in __libc_start_main (main=0x42aa60 <main>, argc=4, ubp_av=0x7fffffffde38, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde28) at libc-start.c:258 #7 0x000000000042aaa9 in _start () (gdb) list 464 ;; 465 466 467 (************************** QUERY SUBCOMMAND ***************************) 468 469 let query_package () = 470 471 let long_format = 472 "package: %p\ndescription: %D\nversion: %v\narchive(s): %A\nlinkopts: %O\nlocation: %d\n" in 473 let i_format =
GDB only understands location data at the moment, so you can’t yet query variables (although I understand OCaml generates the correct DWARF info for this, GDB just doesn’t know how to print OCaml expressions).
There will also be some limitations on the debuginfo built at first. At the moment it doesn’t include debuginfo for OCaml libraries called from an OCaml program, because of problems that need to be worked out with the toolchain. Mixed OCaml binary / C library debuginfo does work.