Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] How do I get a stack trace in a running program?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: HENRIKSON, JEFFREY <JEFHEN@S...>
Subject: RE: [Caml-list] How do I get a stack trace in a running program?
> Therefore it seems there is no way to trigger the printing of 
> backtraces except by modifying the sources to the OCaml 
> compuiler. Except that possibly you could write a C extension 
> which calls caml_print_exception_backtrace, if that symbol is 
> visible, and it might do the right thing, with luck!
> 
> It would be really nice if OCaml (a) recorded the function 
> parameters in backtraces, and (b) made available the 
> backtraces programmatically. Both Java and Perl do this, so 
> there is no excuse for our favorite language not to do it too!

I brought this up on the list a year or two back.  I still see this as a
stumbling block on the path toward production code in ocaml.  One use
case was wanting to be able to email bug reports from crashes on user
machines back to myself.  Only having the ability to print on stdout
without compiler modification makes this a headache.

I do see parameter recording and printing as necessary for a robust
implementation.  In the toplevel, it seems that printing a stack frame
parameter means the same thing as printing a value.  It should be
configurable as a default behavior to print uncaught exceptions with a
stack backtrace, perhaps with some kind of #turn_on_backtrace_printing
toplevel command.  However, in binary executables, I would be happy to
have binary runtime parameter printing, ala the OReily book's C
interface chapter.  Even a supported way to configure binary parameter
printing in the toplevel via a user handler would be very helpful for
me.  I had a C hack to get a backtrace out sans parameters in the
toplevel in version 3.04, but it broke when I went to 3.06.

Regards,


Jeff Henrikson