Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: John Whitington <john@coherentgraphics.co.uk>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] ANN: exn-source - exception backtraces with source code printing
Date: Sun, 19 Oct 2014 20:26:41 +0200	[thread overview]
Message-ID: <CAPFanBGJgrBDECesJDUZiXRSwp=ZgbDtRCLjXpKEh8j_7WQV_Q@mail.gmail.com> (raw)
In-Reply-To: <5443FCE6.50206@coherentgraphics.co.uk>

[-- Attachment #1: Type: text/plain, Size: 2150 bytes --]

That looks like a nice project ! Another trick I use personally is to run
the faulting program from inside Emacs's compile-mode (using "build && run"
instead of just "build" as a compilatoin command), and piggy-back on its
parsing of OCaml error locations to ask Emacs to drive me around the
relevant files.
I'm sure there are scenarios where your simultaneous view of all fragments
at once can be very helpful, and I'm also interested in the uses of the new
backtrace/callstack inspection API.

> (we can't use exceptions at all inside a backtrace handler, for example)

I'm a bit surprised by this. Part of the point of reifying traces into
datatypes (raw_backtrace, backtrace_slot) was to make them persistent.
set_uncaught_exception_handler is passed a raw trace that should not be
mutated by raising new exceptions. What breaks if you use exceptions inside
a backtrace handler?

On Sun, Oct 19, 2014 at 8:03 PM, John Whitington <
john@coherentgraphics.co.uk> wrote:

> Hi,
>
> OCaml 4.02 has new facilities for installing a new backtrace handler, and
> processing the back trace symbolically. As a little proof of concept, I've
> built a package which you can add to any project to get backtrace with
> source code printed and highlighted:
>
> https://github.com/johnwhitington/exn-source
>
> Here's the start of a backtrace:
>
> http://www.coherentpdf.com/exnsource.png
>
> By default, it prints five lines either side, and looks the current
> directory for source code. But as one can see from the screenshot, one can
> add /usr/local/lib/ocaml to get stdlib source and so on...
>
> It's somewhat difficult to test this kind of thing (we can't use
> exceptions at all inside a backtrace handler, for example), so I'm
> appealing for help. Attach exn-source to your code and let me know how you
> get on...
>
> Thanks,
>
> --
> John Whitington
> Director, Coherent Graphics Ltd
> http://www.coherentpdf.com/
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 3165 bytes --]

  reply	other threads:[~2014-10-19 18:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19 18:03 John Whitington
2014-10-19 18:26 ` Gabriel Scherer [this message]
2014-10-19 18:55   ` John Whitington
2014-10-19 19:05     ` Gabriel Scherer
     [not found]       ` <54441347.904@coherentgraphics.co.uk>
2014-10-19 19:50         ` Gabriel Scherer
2014-10-20  9:15 ` Nicolas Boulay
2014-10-20  9:35 ` Peter Zotov
2014-10-20 11:52   ` John Whitington
2014-10-20 12:06     ` Peter Zotov
2014-10-20 12:15       ` Francois Berenger
2014-10-20 18:28         ` Török Edwin
2014-10-23  8:32 ` John Whitington
2014-10-23 11:48   ` Sébastien Hinderer
2014-10-23 16:43     ` Gabriel Scherer

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='CAPFanBGJgrBDECesJDUZiXRSwp=ZgbDtRCLjXpKEh8j_7WQV_Q@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=john@coherentgraphics.co.uk \
    /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