From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4D81EBB91 for ; Tue, 11 Jan 2005 11:30:14 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0BAUDV9015966 for ; Tue, 11 Jan 2005 11:30:13 +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 LAA32022 for ; Tue, 11 Jan 2005 11:30:13 +0100 (MET) Received: from alex.barettalocal.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0BAUCl1028898 for ; Tue, 11 Jan 2005 11:30:13 +0100 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by alex.barettalocal.com (Postfix) with ESMTP id 164FF2BABEA; Tue, 11 Jan 2005 11:30:12 +0100 (CET) Message-ID: <41E3AAB3.6000200@barettadeit.com> Date: Tue, 11 Jan 2005 11:30:11 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Richard Jones Cc: Ocaml Subject: Re: [Caml-list] How do I get a stack trace in a running program? References: <41E2B978.5090106@barettadeit.com> <20050110175844.GA11261@furbychan.cocan.org> <41E2C4DF.4080706@barettadeit.com> In-Reply-To: <41E2C4DF.4080706@barettadeit.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41E3AAB5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41E3AAB4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 caml-list:01 stack:01 baretta:01 wrote:01 wrote:01 ocaml:01 backtrace:01 lib:01 backtrace:01 lib:01 failwith:01 stderr:01 ocamlfind:01 ocamlc:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.0 X-Spam-Level: Alex Baretta wrote: > Richard Jones wrote: > >> 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! > > > This is more or less what I'm doing... This failed pathetically. This is the best I was able to do. alex@alex:~/darcs/sw/lib/unixlib-addons$ cat backtrace.ml open Unix external print_exception_backtrace : file_descr -> unit = "user_print_exception_backtrace" alex@alex:~/darcs/sw/lib/unixlib-addons$ cat fail.ml open Backtrace let () = try failwith "No backtrace, folks!" with x -> print_exception_backtrace Unix.stderr alex@alex:~/darcs/sw/lib/unixlib-addons$ ocamlfind ocamlc -g -package "unixlib-addons" -linkpkg fail.ml -o fail Error on dynamically loaded library: ./dllunixlib-addons.so: undefined symbol: caml_start_code Why in the world can't I get a backtrace for a caught exception!? 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) The FreerP Project