caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* How do I get a stack trace in a running program?
@ 2005-01-10 17:20 Alex Baretta
  2005-01-10 17:58 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Baretta @ 2005-01-10 17:20 UTC (permalink / raw)
  To: Ocaml

I need to print a backtrace for an exception which I catch in the 
outmost loop of a long-running server, which the exception must not 
kill. Printexc does not help here.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [Caml-list] How do I get a stack trace in a running program?
@ 2005-01-10 19:04 HENRIKSON, JEFFREY
  0 siblings, 0 replies; 6+ messages in thread
From: HENRIKSON, JEFFREY @ 2005-01-10 19:04 UTC (permalink / raw)
  To: caml-list

> 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-11 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-10 17:20 How do I get a stack trace in a running program? Alex Baretta
2005-01-10 17:58 ` [Caml-list] " Richard Jones
2005-01-10 18:09   ` Alex Baretta
2005-01-11 10:30     ` Alex Baretta
     [not found]       ` <20050111103546.GA16257@furbychan.cocan.org>
2005-01-11 10:59         ` Alex Baretta
2005-01-10 19:04 HENRIKSON, JEFFREY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).