From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9A8557F02D for ; Sun, 19 Oct 2014 20:27:23 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.181 as permitted sender) identity=mailfrom; client-ip=209.85.214.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ob0-f181.google.com) identity=helo; client-ip=209.85.214.181; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ob0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArwDAE4BRFTRVda1ZGdsb2JhbABbgwtTWASDArkDjh6BcIdOAoEHBxYBBHmEAwEBAwESER0BGxILAQMBCwYFBwQaHQICIgERAQUBChIGExIQiAgBAwkIDZ8cboswgXKDEIgQChknAwpnhUoBAQEBAQEEAQEBAQEBARUBBQ6QPwQHgneBVAWFFQWNbYM/hxOBMDyQNYIMGCmDEVeBRTsvAYJKAQEB X-IPAS-Result: ArwDAE4BRFTRVda1ZGdsb2JhbABbgwtTWASDArkDjh6BcIdOAoEHBxYBBHmEAwEBAwESER0BGxILAQMBCwYFBwQaHQICIgERAQUBChIGExIQiAgBAwkIDZ8cboswgXKDEIgQChknAwpnhUoBAQEBAQEEAQEBAQEBARUBBQ6QPwQHgneBVAWFFQWNbYM/hxOBMDyQNYIMGCmDEVeBRTsvAYJKAQEB X-IronPort-AV: E=Sophos;i="5.04,749,1406584800"; d="scan'208";a="101914257" Received: from mail-ob0-f181.google.com ([209.85.214.181]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Oct 2014 20:27:22 +0200 Received: by mail-ob0-f181.google.com with SMTP id wm4so2856309obc.12 for ; Sun, 19 Oct 2014 11:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=MEz2cLOPz80e3xW0Gcz8lruScCYPNmp93saA1t54fnc=; b=dXRrVgLiT3dnv9FNBOMK1fi3oJTk+7tYIMfmeo6w46cAzoUXEJCL3ysq75itbQqAe+ /9dADFIjCbPHAEgOqni+yZictJL8c73PuP3N9KDqNgJNp9hLBq5n3oCH5SEqCi3G1PSt HfAiCdHVNVnVbLGRJbdOdz3fVL9Ep2DQBmAyTBa9PLZx+07jDdlo2HBzqVC+XWpNgSZi iB3QL8PkUp5+E0X88coUDi9NSQ831bE3areiMO2zWmLACDPifFJ+dKl8fnoInOLew8e0 la0GgmVuewVdOobAW7CI/H+PbzUttI2u5Vf6p9ZNNnfTLggEuk33qh4/xZHZtilMuqRG DAFw== X-Received: by 10.60.150.140 with SMTP id ui12mr15820602oeb.27.1413743241729; Sun, 19 Oct 2014 11:27:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.105.196 with HTTP; Sun, 19 Oct 2014 11:26:41 -0700 (PDT) In-Reply-To: <5443FCE6.50206@coherentgraphics.co.uk> References: <5443FCE6.50206@coherentgraphics.co.uk> From: Gabriel Scherer Date: Sun, 19 Oct 2014 20:26:41 +0200 Message-ID: To: John Whitington Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=047d7b5d502eba40bb0505cabf2d Subject: Re: [Caml-list] ANN: exn-source - exception backtraces with source code printing --047d7b5d502eba40bb0505cabf2d Content-Type: text/plain; charset=UTF-8 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 > --047d7b5d502eba40bb0505cabf2d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
That looks like a nice project ! Another trick I use = personally is to run the faulting program from inside Emacs's compile-m= ode (using "build && run" instead of just "build&quo= t; 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 fragm= ents at once can be very helpful, and I'm also interested in the uses o= f the new backtrace/callstack inspection API.

> (we c= an't use exceptions at all inside a backtrace handler, for example)
=
I'm a bit surprised by this. Part of the point of reifying tr= aces into datatypes (raw_backtrace, backtrace_slot) was to make them persis= tent. set_uncaught_exception_handler is passed a raw trace that should not = be mutated by raising new exceptions. What breaks if you use exceptions ins= ide 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 p= rocessing 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 s= ource 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 directo= ry for source code. But as one can see from the screenshot, one can add /us= r/local/lib/ocaml to get stdlib source and so on...

It's somewhat difficult to test this kind of thing (we can't use ex= ceptions at all inside a backtrace handler, for example), so I'm appeal= ing 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.cohere= ntpdf.com/


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners<= /a>
Bug reports:
http://caml.inria.fr/bin/caml-bugs

--047d7b5d502eba40bb0505cabf2d--