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
debugging techniques?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: "ocaml_beginners"::[] debugging techniques?
From: Daniel Andor <Daniel.Andor@p...>
Subject: "ocaml_beginners"::[] debugging techniques?
Date: Fri, 4 Jul 2003 18:45:18 +0100

> Is there any way to get Exceptions to print a little bit more informative 
> info, like source file name/line?
> And is there a way to use gdb/ocamldebug to give me a stacktrace when I have 
> an uncaught exception?

Set "OCAMLRUNPARAM" environmental variable to include "b" option.
Then, the bytecode program prints the stack trace when it is stopped
by an uncaught exception. See Section 10.2 of the online manual for
the detail.

ocamldebug can execute the program backward. If your program stops
running, use "backstep" and you can go to the time when the exception
is going to be raised. (Then use "bt" command for the backtrace)
(But, in my experience, sometimes the debugger goes to the wrong
position when doing backward execution. Does anybody know whether the
backward execution is always accurate?)

Both functionality are available only when the program is compiled to
the bytecode with "-g" option. For the native code, you are out of
luck, unfortunately.

Yamagata Yoriyuki