How to get the line number of an exception in OCaml without debugging symbols?
Is there a good way to get the line number of exception in OCaml without debugging symbols? Certainly, if we turn on debugging symbols and run with OCAMLRUNPARAM=b , we can get the backtrace. However, I don't really need the whole backtrace and I'd like a solution without debugging symbols. At the moment, we can write code like try assert false with x -> failwith (Printexc.to_string x ^ "\nMore useful message") in order to get the file and line number from assert, but this seems awkward. Is there a better way to get the file and line number of the exception? There are global symbols __FILE__