Version française
Home     About     Download     Resources     Contact us    
Browse thread
exception error trace back in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: exception error trace back in ocaml
On 21-06-2010, lin hong <lhong@amnh.org> wrote:
>
> I have problem getting a full traceback of some exception error. The
> traceback looks like this:
>
> Fatal error: exception Invalid_argument("index out of bounds")
> Raised at file "camlinternalLazy.ml", line 33, characters 10-11
> Called from file "list.ml", line 74, characters 24-34
>
> But that's all I got, both camlinternalLazy.ml and list.ml are ocaml
> source code, I still don't know which part of my code trigger it. Also, in
> camlinternalLazy.ml line 33, there is a "try .... with e -> raise e", is
> this the reason I don't have a full traceback -- Maybe something else
> catch the "raise e" ?  Any idea?
>

To get the full trace, you need to compile your code with "-g", i.e.
ocamlc -g foo.ml 

If you don't have this debug flag, you won't see calls from the code you
compiled.

The "try ... with e -> raise e" just re-raise the exception and you will
be able to see it in the full trace.

Regards,
Sylvain Le Gall