Debugging an OCaml program that has an unhandled exception is fairly easy, because the program stops running and you can obtain a backtrace by running in ocamldebug
or setting the OCAMLRUNPARAM
environment variable to b
. Is there any way to obtain such a backtrace for a handled exception?
Note: Modifying the program so it does not handle the exception is of course one option. However, I'd like to avoid modifying the program if possible. Something analogous to gdb
's catch
command would be great.