Browse thread
How do I get a stack trace in a running program?
-
Alex Baretta
-
Richard Jones
-
Alex Baretta
- Alex Baretta
-
Alex Baretta
-
Richard Jones
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alex Baretta <alex@b...> |
| Subject: | Re: [Caml-list] How do I get a stack trace in a running program? |
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/>