* exception error trace back in ocaml
@ 2010-06-21 18:15 lin hong
2010-06-21 20:47 ` Sylvain Le Gall
0 siblings, 1 reply; 4+ messages in thread
From: lin hong @ 2010-06-21 18:15 UTC (permalink / raw)
To: caml-list
Hi all,
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?
Thanks.
Lin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: exception error trace back in ocaml
2010-06-21 18:15 exception error trace back in ocaml lin hong
@ 2010-06-21 20:47 ` Sylvain Le Gall
2010-06-22 14:55 ` [Caml-list] " lin hong
[not found] ` <12944_1277218550_o5MEtn0x008505_53601.216.73.250.47.1277218543.squirrel@webmail.amnh.org>
0 siblings, 2 replies; 4+ messages in thread
From: Sylvain Le Gall @ 2010-06-21 20:47 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Re: exception error trace back in ocaml
2010-06-21 20:47 ` Sylvain Le Gall
@ 2010-06-22 14:55 ` lin hong
[not found] ` <12944_1277218550_o5MEtn0x008505_53601.216.73.250.47.1277218543.squirrel@webmail.amnh.org>
1 sibling, 0 replies; 4+ messages in thread
From: lin hong @ 2010-06-22 14:55 UTC (permalink / raw)
To: caml-list
> 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.
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Re: exception error trace back in ocaml
[not found] ` <12944_1277218550_o5MEtn0x008505_53601.216.73.250.47.1277218543.squirrel@webmail.amnh.org>
@ 2010-06-22 15:17 ` Eric Cooper
0 siblings, 0 replies; 4+ messages in thread
From: Eric Cooper @ 2010-06-22 15:17 UTC (permalink / raw)
To: caml-list
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?
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-22 15:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 18:15 exception error trace back in ocaml lin hong
2010-06-21 20:47 ` Sylvain Le Gall
2010-06-22 14:55 ` [Caml-list] " lin hong
[not found] ` <12944_1277218550_o5MEtn0x008505_53601.216.73.250.47.1277218543.squirrel@webmail.amnh.org>
2010-06-22 15:17 ` Eric Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox