From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 4419E7FAD5 for ; Thu, 23 Oct 2014 18:43:59 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.218.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.218.52 as permitted sender) identity=mailfrom; client-ip=209.85.218.52; receiver=mail3-smtp-sop.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 (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-oi0-f52.google.com) identity=helo; client-ip=209.85.218.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-oi0-f52.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4BADAvSVTRVdo0m2dsb2JhbABcFoNMXIMCuQwyjk6BcIdNAoELBxYBEQEBAQEBBgsLCRQuhAIBAQEDARIRHQEbEgwDAQsGBQsNDR0CAiIBEQEFAQoSBgESEhCICgEDCQgNp39uizGBcoMRiEcKGScDCmeFUQEBAQEGAQEBAQEXAQUOjjKCFAuCd4FUBYUVBY1ygz+HEoFtjWSEZxgpg2iBRjsvAYJKAQEB X-IPAS-Result: Ap4BADAvSVTRVdo0m2dsb2JhbABcFoNMXIMCuQwyjk6BcIdNAoELBxYBEQEBAQEBBgsLCRQuhAIBAQEDARIRHQEbEgwDAQsGBQsNDR0CAiIBEQEFAQoSBgESEhCICgEDCQgNp39uizGBcoMRiEcKGScDCmeFUQEBAQEGAQEBAQEXAQUOjjKCFAuCd4FUBYUVBY1ygz+HEoFtjWSEZxgpg2iBRjsvAYJKAQEB X-IronPort-AV: E=Sophos;i="5.04,776,1406584800"; d="scan'208";a="84394303" Received: from mail-oi0-f52.google.com ([209.85.218.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Oct 2014 18:43:57 +0200 Received: by mail-oi0-f52.google.com with SMTP id a3so988523oib.25 for ; Thu, 23 Oct 2014 09:43:57 -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 :content-type; bh=wTbDV6oQZPVtqVei4sugChlVPLQUO/BwNNfgqrXNsp8=; b=l0EA6hI5GObo7Hp9rOEkqQs0UpKyQCEeeiDyf4tL+fdJiAIVSx22s5JlyN4LKoktHE ujFTTyTFS3nJv8duQNVl1fNMbzvcf8ybA3biuB9PuJ1W7Z3GdWYc7F1r8eUCSVHoCuGH cR5NXnaGB/mliYstyz8IN7/dNfLy+9RUck2fYY11PZFGdVQ41zSk6xIkyvxTpnmMMyZ1 mfrKKNjF0VOfJII2BwrBtOmGt7GNtwd0GozLwXv9vkukdqCRYTtPHdcmBMk9bUsmKWbB 9Uopj5CvGS9snTPAGnL9uoqPYGbirWvpdw+Tb9liTGpOl2EuqIqjzpFpoe0hfB1V2Sw3 Z/4w== X-Received: by 10.60.162.71 with SMTP id xy7mr2040821oeb.67.1414082636932; Thu, 23 Oct 2014 09:43:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.105.196 with HTTP; Thu, 23 Oct 2014 09:43:16 -0700 (PDT) In-Reply-To: <20141023114858.GB8128@pl-59055.rocqadm.inria.fr> References: <5443FCE6.50206@coherentgraphics.co.uk> <5448BD20.3020603@coherentgraphics.co.uk> <20141023114858.GB8128@pl-59055.rocqadm.inria.fr> From: Gabriel Scherer Date: Thu, 23 Oct 2014 18:43:16 +0200 Message-ID: To: =?UTF-8?Q?S=C3=A9bastien_Hinderer?= , caml users Content-Type: multipart/alternative; boundary=047d7b33c6ea41ed4d050619c5a6 Subject: Re: [Caml-list] ANN: exn-source - exception backtraces with source code printing --047d7b33c6ea41ed4d050619c5a6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable exn-source produces an output using ANSI escape codes. Here is a text version (ansifilter --text): http://gallium.inria.fr/~scherer/tmp/tmp/exnsource-example.text and a HTML version http://gallium.inria.fr/~scherer/tmp/tmp/exnsource-example.html To (re)produce this output I ran the command OCAMLRUNPARAM=3D"b" ./cpdf -debug foo.pdf from the the tag v1.7 of the repo https://github.com/johnwhitington/cpdf-source/ (after installing both camlpdf (from OPAM) and exnsource (from github)) with the following patch applied: diff --git a/Makefile b/Makefile index d706771..c4f9523 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SOURCES =3D $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml RESULT =3D cpdf -PACKS =3D camlpdf +PACKS =3D camlpdf exnsource OCAMLNCFLAGS =3D -g OCAMLBCFLAGS =3D -g diff --git a/cpdfcommandrun.ml b/cpdfcommandrun.ml index 2a43a43..bb0af72 100644 --- a/cpdfcommandrun.ml +++ b/cpdfcommandrun.ml @@ -1,2 +1,4 @@ +let _ =3D Exnsource.add_dir "" + let _ =3D Cpdfcommand.go () On Thu, Oct 23, 2014 at 1:48 PM, S=C3=A9bastien Hinderer < Sebastien.Hinderer@inria.fr> wrote: > Hi, > > John Whitington (2014/10/23 09:32 +0100): > > Hi, > > > > John Whitington 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 > > This seems very interesting, thanks! > > > >Here's the start of a backtrace: > > > > > >http://www.coherentpdf.com/exnsource.png > > Just wanted to mention that not everybody can look at pictures, so it > would be great to show the text itself whenever it'spossible. > > Thanks, > S=C3=A9bastien. > > -- > 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 > --047d7b33c6ea41ed4d050619c5a6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
exn-source produces an output usi= ng ANSI escape codes. Here is a text version (ansifilter --text):
=C2=A0= http://gallium.inria.fr/~scherer/tmp/tmp/exnsource-example.text
and a HTML version
=C2=A0 http://gallium.inria.fr/~scherer/tmp/tmp/= exnsource-example.html

To (re)produce this output I ran th= e command
=C2=A0 OCAMLRUNPARAM=3D"b" ./cpdf -debug foo.p= df
from the the tag v1.7 of the repo
=C2=A0 https://github.com/johnwhitington/c= pdf-source/
(after installing both camlpdf (from OPAM) and exn= source (from github))
with the following patch applied:

diff --gi= t a/Makefile b/Makefile
index d706771..c4f9523 100644
--- a/Makefile<= br>+++ b/Makefile
@@ -5,7 +5,7 @@ SOURCES =3D $(foreach x,$(MODS),$(x).m= l $(x).mli) cpdfcommandrun.ml
= =C2=A0
=C2=A0RESULT =3D cpdf
=C2=A0
-PACKS =3D camlpdf
+PACKS = =3D camlpdf exnsource
=C2=A0
=C2=A0OCAMLNCFLAGS =3D -g
=C2=A0OCAML= BCFLAGS =3D -g
diff --git a/cpdfcom= mandrun.ml b/cpdfcommandrun.ml=
index 2a43a43..bb0af72 100644
--- a/cpdfcommandrun.ml
+++ b/cp= dfcommandrun.ml
@@ -1,2 +1,4 @@
+let _ =3D Exnsource.add_dir &quo= t;"
+
=C2=A0let _ =3D Cpdfcommand.go ()
=C2=A0



--047d7b33c6ea41ed4d050619c5a6--