From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id DC11ABB91 for ; Mon, 10 Jan 2005 20:04:35 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0AJ4Zv6020479 for ; Mon, 10 Jan 2005 20:04:35 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA04826 for ; Mon, 10 Jan 2005 20:04:34 +0100 (MET) Received: from rdcmx1.safeco.com (rdcmx1.safeco.com [12.144.132.31]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0AJ4WHt020461 for ; Mon, 10 Jan 2005 20:04:33 +0100 Received: from psmrdcex14.psm.pin.safeco.com (Not Verified[12.144.134.38]) by rdcmx1.safeco.com id ; Mon, 10 Jan 2005 11:04:29 -0800 Received: from safeco.com ([168.147.237.20]) by psmrdcex14.psm.pin.safeco.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 10 Jan 2005 11:04:29 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 MIME-Version: 1.0 Subject: RE: [Caml-list] How do I get a stack trace in a running program? Date: Mon, 10 Jan 2005 11:04:29 -0800 Message-ID: <9410EC84C0872141B27A2726613EF45D02A52E24@psmrdcex01.psm.pin.safeco.com> Thread-Topic: [Caml-list] How do I get a stack trace in a running program? Thread-Index: AcT3PrpywPA5NmeMQO6QNxRVBaBwQgABg59w From: "HENRIKSON, JEFFREY" To: X-OriginalArrivalTime: 10 Jan 2005 19:04:29.0835 (UTC) FILETIME=[364385B0:01C4F747] Content-Class: urn:content-classes:message Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 41E2D1C3.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41E2D1C0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 stack:01 henrikson:01 ocaml:01 backtrace:01 ocaml:01 bug:01 stdout:01 compiler:01 toplevel:01 stack:01 uncaught:01 backtrace:01 toplevel:01 binary:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: > Therefore it seems there is no way to trigger the printing of=20 > backtraces except by modifying the sources to the OCaml=20 > compuiler. Except that possibly you could write a C extension=20 > which calls caml_print_exception_backtrace, if that symbol is=20 > visible, and it might do the right thing, with luck! >=20 > It would be really nice if OCaml (a) recorded the function=20 > parameters in backtraces, and (b) made available the=20 > backtraces programmatically. Both Java and Perl do this, so=20 > 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