On Fri, Dec 08, 2006 at 05:16:37PM +0100, Francois Colonna wrote:
> is it possible to know in which file and at which line an exception
> occurred ?
Yes indeed, this is a good question!
The short answer is that if your program is compiled to bytecode
(ocamlc, not ocamlopt) then you can set the following environment
variable before running it:
OCAMLRUNPARAM=b
which will cause the program to through a reasonably reliable,
although not perfect, stack trace. Assuming the exception makes its
way all the way out and quits the program.
It is not possible to catch an exception and get the stack trace.
With native code, OCAMLRUNPARAM=b doesn't work either.
Now this is a feature which is oft requested. In fact there is a bug
report and patch which adds a useful debugging feature for catching
exceptions and finding out where they came from. Go and vote for it!
http://caml.inria.fr/mantis/view.php?id=3885
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!
.