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="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 = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml
 
 RESULT = cpdf
 
-PACKS = camlpdf
+PACKS = camlpdf exnsource
 
 OCAMLNCFLAGS = -g
 OCAMLBCFLAGS = -g
diff --git a/cpdfcommandrun.ml b/cpdfcommandrun.ml
index 2a43a43..bb0af72 100644
--- a/cpdfcommandrun.ml
+++ b/cpdfcommandrun.ml
@@ -1,2 +1,4 @@
+let _ = Exnsource.add_dir ""
+
 let _ = Cpdfcommand.go ()
 


On Thu, Oct 23, 2014 at 1:48 PM, Sébastien 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ébastien.

--
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