* [Caml-list] :: how to locate the source of exception
@ 2013-01-24 12:14 沈胜宇
2013-01-24 12:20 ` Philippe Veber
2013-01-24 13:15 ` Malcolm Matalka
0 siblings, 2 replies; 8+ messages in thread
From: 沈胜宇 @ 2013-01-24 12:14 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 232 bytes --]
Dear all:
My program written in ocaml terminate with the following output:
Fatal error: exception Invalid_argument("index out of bounds")
So how should I find out the lcoation in source code that raise this exception?
Shen
[-- Attachment #2: Type: text/html, Size: 348 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] :: how to locate the source of exception
2013-01-24 12:14 [Caml-list] :: how to locate the source of exception 沈胜宇
@ 2013-01-24 12:20 ` Philippe Veber
2013-01-24 12:30 ` François Pessaux
2013-01-24 13:46 ` 沈胜宇
2013-01-24 13:15 ` Malcolm Matalka
1 sibling, 2 replies; 8+ messages in thread
From: Philippe Veber @ 2013-01-24 12:20 UTC (permalink / raw)
To: 沈胜宇; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
Dear Shen,
you can run your program in bytecode setting the OCAMLRUNPARAM correctly
and you'll see the whole backtrace, like in
OCAMLRUNPARAM=b ./myprogram
hope this helps,
Philippe.
2013/1/24 沈胜宇 <syshen@nudt.edu.cn>
> Dear all:
>
> My program written in ocaml terminate with the following output:
>
> Fatal error: exception Invalid_argument("index out of bounds")
>
>
> So how should I find out the lcoation in source code that raise this
> exception?
>
> Shen
>
[-- Attachment #2: Type: text/html, Size: 876 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] :: how to locate the source of exception
2013-01-24 12:20 ` Philippe Veber
@ 2013-01-24 12:30 ` François Pessaux
2013-01-24 13:46 ` 沈胜宇
1 sibling, 0 replies; 8+ messages in thread
From: François Pessaux @ 2013-01-24 12:30 UTC (permalink / raw)
To: caml-list
Hello,
>> My program written in ocaml terminate with the following output:
>> Fatal error: exception Invalid_argument("index out of bounds")
>> So how should I find out the lcoation in source code that raise this exception?
> you can run your program in bytecode setting the OCAMLRUNPARAM correctly and you'll see the whole backtrace, like in
> OCAMLRUNPARAM=b ./myprogram
Just remember to compile with the -g option to really get the backtrace otherwise you'll get something like
Fatal error: exception XXX
(Program not linked with -g, cannot print stack backtrace).
Regards,
-- François
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] :: how to locate the source of exception
2013-01-24 12:14 [Caml-list] :: how to locate the source of exception 沈胜宇
2013-01-24 12:20 ` Philippe Veber
@ 2013-01-24 13:15 ` Malcolm Matalka
2013-01-24 13:29 ` Török Edwin
2013-01-24 13:48 ` 沈胜宇
1 sibling, 2 replies; 8+ messages in thread
From: Malcolm Matalka @ 2013-01-24 13:15 UTC (permalink / raw)
To: 沈胜宇; +Cc: caml-list
Run with backtraces on. I think this requires bytecode but I can't
remember:
http://stackoverflow.com/questions/145880/how-do-i-get-a-stack-trace-in-ocaml
沈胜宇 <syshen@nudt.edu.cn> writes:
> Dear all:
>
>
> My program written in ocaml terminate with the following output:
>
>
> Fatal error: exception Invalid_argument("index out of bounds")
>
>
>
>
> So how should I find out the lcoation in source code that raise this exception?
>
>
> Shen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] :: how to locate the source of exception
2013-01-24 13:15 ` Malcolm Matalka
@ 2013-01-24 13:29 ` Török Edwin
2013-01-24 13:52 ` Daniel Bünzli
2013-01-24 13:48 ` 沈胜宇
1 sibling, 1 reply; 8+ messages in thread
From: Török Edwin @ 2013-01-24 13:29 UTC (permalink / raw)
To: caml-list
On 01/24/2013 03:15 PM, Malcolm Matalka wrote:
> Run with backtraces on. I think this requires bytecode but I can't
> remember:
>
> http://stackoverflow.com/questions/145880/how-do-i-get-a-stack-trace-in-ocaml
It works with native code too if you set Printexc.record_backtrace as written above, but
bytecode backtraces are usually more reliable (the native backtrace gets cut off sometimes,
perhaps due to some 3rdparty libraries not being compiled with -g).
--Edwin
>
> 沈胜宇 <syshen@nudt.edu.cn> writes:
>
>> Dear all:
>>
>>
>> My program written in ocaml terminate with the following output:
>>
>>
>> Fatal error: exception Invalid_argument("index out of bounds")
>>
>>
>>
>>
>> So how should I find out the lcoation in source code that raise this exception?
>>
>>
>> Shen
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: [Caml-list] :: how to locate the source of exception
2013-01-24 12:20 ` Philippe Veber
2013-01-24 12:30 ` François Pessaux
@ 2013-01-24 13:46 ` 沈胜宇
1 sibling, 0 replies; 8+ messages in thread
From: 沈胜宇 @ 2013-01-24 13:46 UTC (permalink / raw)
To: Philippe Veber; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
Dear Philippe
Great, I got the trace, thank you very much.
Shen
-----原始邮件-----
发件人: "Philippe Veber" <philippe.veber@gmail.com>
发送时间: 2013-01-24 20:20:52 (星期四)
收件人: "沈胜宇" <syshen@nudt.edu.cn>
抄送: caml-list@inria.fr
主题: Re: [Caml-list] :: how to locate the source of exception
Dear Shen,
you can run your program in bytecode setting the OCAMLRUNPARAM correctly and you'll see the whole backtrace, like in
OCAMLRUNPARAM=b ./myprogram
hope this helps,
Philippe.
2013/1/24 沈胜宇 <syshen@nudt.edu.cn>
Dear all:
My program written in ocaml terminate with the following output:
Fatal error: exception Invalid_argument("index out of bounds")
So how should I find out the lcoation in source code that raise this exception?
Shen
[-- Attachment #2: Type: text/html, Size: 1504 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: [Caml-list] :: how to locate the source of exception
2013-01-24 13:15 ` Malcolm Matalka
2013-01-24 13:29 ` Török Edwin
@ 2013-01-24 13:48 ` 沈胜宇
1 sibling, 0 replies; 8+ messages in thread
From: 沈胜宇 @ 2013-01-24 13:48 UTC (permalink / raw)
To: Malcolm Matalka; +Cc: caml-list
Dear Matalka:
I got the trace by following you method, thank you for your help
Shen
> -----原始邮件-----
> 发件人: "Malcolm Matalka" <mmatalka@gmail.com>
> 发送时间: 2013-01-24 21:15:47 (星期四)
> 收件人: "沈胜宇" <syshen@nudt.edu.cn>
> 抄送: caml-list@inria.fr
> 主题: Re: [Caml-list] :: how to locate the source of exception
>
> Run with backtraces on. I think this requires bytecode but I can't
> remember:
>
> http://stackoverflow.com/questions/145880/how-do-i-get-a-stack-trace-in-ocaml
>
> 沈胜宇 <syshen@nudt.edu.cn> writes:
>
> > Dear all:
> >
> >
> > My program written in ocaml terminate with the following output:
> >
> >
> > Fatal error: exception Invalid_argument("index out of bounds")
> >
> >
> >
> >
> > So how should I find out the lcoation in source code that raise this exception?
> >
> >
> > Shen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] :: how to locate the source of exception
2013-01-24 13:29 ` Török Edwin
@ 2013-01-24 13:52 ` Daniel Bünzli
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Bünzli @ 2013-01-24 13:52 UTC (permalink / raw)
To: Török Edwin; +Cc: caml-list
Le jeudi, 24 janvier 2013 à 14:29, Török Edwin a écrit :
> It works with native code too if you set Printexc.record_backtrace as written above, but
> bytecode backtraces are usually more reliable (the native backtrace gets cut off sometimes,
> perhaps due to some 3rdparty libraries not being compiled with -g).
I think it's due to tail call optimisation.
Best,
Daniel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-24 13:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 12:14 [Caml-list] :: how to locate the source of exception 沈胜宇
2013-01-24 12:20 ` Philippe Veber
2013-01-24 12:30 ` François Pessaux
2013-01-24 13:46 ` 沈胜宇
2013-01-24 13:15 ` Malcolm Matalka
2013-01-24 13:29 ` Török Edwin
2013-01-24 13:52 ` Daniel Bünzli
2013-01-24 13:48 ` 沈胜宇
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox