caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alex Baretta <alex@barettadeit.com>
To: Richard Jones <rich@annexia.org>
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] How do I get a stack trace in a running program?
Date: Tue, 11 Jan 2005 11:30:11 +0100	[thread overview]
Message-ID: <41E3AAB3.6000200@barettadeit.com> (raw)
In-Reply-To: <41E2C4DF.4080706@barettadeit.com>

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)
<http://www.asxcaml.org/>

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


  reply	other threads:[~2005-01-11 10:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 17:20 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 [this message]
     [not found]       ` <20050111103546.GA16257@furbychan.cocan.org>
2005-01-11 10:59         ` Alex Baretta
2005-01-10 19:04 HENRIKSON, JEFFREY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41E3AAB3.6000200@barettadeit.com \
    --to=alex@barettadeit.com \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).