Re: [Caml-list] Re: exception error trace back in ocaml

2010-06-22 Thread lin hong


 On 21-06-2010, lin hong lh...@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.

Thank you for your reply.

I believe the -g flag is being used during compile though, for I can get
full traceback with other exception error in the code. This is the first
and only exception error without the full trace.


 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

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Re: exception error trace back in ocaml

2010-06-22 Thread Eric Cooper
On 21-06-2010, lin hong lh...@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?

That exception was raised when forcing a lazy value (Lazy.force catches
it and re-raises it).  So you'll need to wrap the expression following
the lazy keyword with a handler for Invalid_argument, and you might
be able to use Printexc.print_backtrace from there.  But I don't know
why the standard backtrace printer can't see into the closure being
forced.

-- 
Eric Cooper e c c @ c m u . e d u

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: exception error trace back in ocaml

2010-06-21 Thread Sylvain Le Gall
On 21-06-2010, lin hong lh...@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

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs