Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Getting exception backtraces without exiting ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-31 (15:47)
From: Denis Bueno <dbueno@g...>
Subject: Getting exception backtraces without exiting ocaml

Is there a way to get an exception backtrace *without* having to exit
the ocaml runtime?

Some background:

I use the OUnit unit testing framework
( to unit test my compiler. I
like the fact that I can see *all* the test failures every time I run
the tests. That is, if one file fails to compile for some reason, I
can still see failures of other tests for independent parts of the

This feature is only possible because OUnit catches exceptions that I
don't catch, runs Printexc.to_string on them, and continues with the
rest of the tests. However, this interferes with ocamlrun's printing
of the exception backtrace, which I really want in case of an
unexpected exception.

Can I get what I want?