From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
To: caml-list@inria.fr
Subject: Re: [Caml-list] A few questions regarding the compiler
Date: Wed, 14 Nov 2001 14:47:13 +0000 (UTC) [thread overview]
Message-ID: <slrn9v50vh.kp3.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <9sttmn$kei$1@qrnik.zagroda>
14 Nov 2001 14:20:37 +0100, David Mentre <David.Mentre@inria.fr> pisze:
> Maybe I have missed something but the point of raising an exception and
> getting its location has already been discussed on the list:
> http://caml.inria.fr/archives/200007/msg00028.html (look also at the thread)
>
> To generate a backtrace, just do an "assert(false)" with the environment
> variable OCAMLRUNPARAM set to "b=1" (without quotes, see man ocamlrun).
I know, but the backtrace is just dumped to stderr just before the
program dies. I would like the program itself to have access to its
own backtrace, so it can do something with it instead of displaying
it in the default format and dying.
I can wrap each top-level value binding which can fail in a 'try
... with exn -> my_handler exn' (i.e. I let my compiler generate such
code), where my_handler does some magic to access the backtrace and
translates it to something readable. I'll now try to do it myself
basing on backtrace.c, but I don't understand yet how it works.
A more convenient way would be to call some magic hook which will
install my_handler for unhandled exceptions instead of the builtin
fatal_uncaught_exception, so I would save those 'try ...' for each
binding. Looking at the code I guess that it's now impossible, calling
fatal_uncaught_exception is just hardwired in appropriate places.
> Yes. Somebody has written a tool to convert a trace in source position:
> http://caml.inria.fr/archives/200109/msg00111.html
This is an external tool which reads original sources and the
backtrace. I want to customize the backtrace itself. Especially as
OCaml sources is only an intermediate step between my language and
executable - they should not be required to be available for producing
a proper backtrace. I will set up my own translation of OCaml positions
to original source positions and embed it in the program.
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^
QRCZAK
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-11-14 14:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-29 15:43 Marcin 'Qrczak' Kowalczyk
2001-11-11 17:38 ` Xavier Leroy
[not found] ` <9smdf7$511$1@qrnik.zagroda>
2001-11-11 21:54 ` Marcin 'Qrczak' Kowalczyk
2001-11-11 22:09 ` Patrick M Doane
2001-11-13 20:36 ` Xavier Leroy
[not found] ` <9ssfsl$fa4$1@qrnik.zagroda>
2001-11-14 3:03 ` Marcin 'Qrczak' Kowalczyk
2001-11-14 9:52 ` Markus Mottl
2001-11-14 13:20 ` David Mentre
[not found] ` <9sttmn$kei$1@qrnik.zagroda>
2001-11-14 14:47 ` Marcin 'Qrczak' Kowalczyk [this message]
2001-11-14 16:45 ` Marcin 'Qrczak' Kowalczyk
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=slrn9v50vh.kp3.qrczak@qrnik.zagroda \
--to=qrczak@knm.org.pl \
--cc=caml-list@inria.fr \
/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