What do you use for tracing and debugging in OCaml?
For debugging I tried ocamldebug and the Emacs plugin.
For tracing I want to be able to print the data constructor of every variable. An example using Camlp4 is shown here: http://caml.inria.fr/pub/docs/tutorial-camlp4/tutorial007.html#toc52
type colour = Red | Green | Blue
let print_colour =
function
Red -> print_string "Red"
| Green -> print_string "Green"
| Blue -> print_string "Blue"
ocamldebug
works fine when you can use bytecode.
If you want to debug a native code application, there is a patch by Thomas gazagnaire on Mantis that allows to step line by line in the OCaml program using gdb. Parts of this patch should be integrated in the next version of OCaml (3.13 or 4.00).
Currently, however, there is no way to print OCaml values, but another patch is coming, using GADT's to define a generic printer function for any type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With