caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@eecs.harvard.edu>
To: Caml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] line number for assert
Date: Tue, 11 Sep 2001 09:49:50 -0400	[thread overview]
Message-ID: <20010911094950.B17440@lakeland.eecs.harvard.edu> (raw)
In-Reply-To: <20010911125325.A29665@dpt-info.u-strasbg.fr>; from luther@dpt-info.u-strasbg.fr on Tue, Sep 11, 2001 at 12:53:25PM +0200

On Tue, Sep 11, 2001 at 12:53:25PM +0200, Sven wrote:
> What about a little tool to be added to the ocaml distribution, which parses a
> file, and convert the char number to line number + column. I guess, from what
> is already done by the toplevel, that this would be trivial to implement, as
> all the code for it is already written.

I have written a little tool that takes a stack trace on stdin,
annotates it with line numbers, and writes the annotated stack trace to
stdout. It also honors #line directives in the source file and thus can
deal with ocamlyacc and the OCaml preprocessor sources (I guess). Here
it is called with a list of directories to search for sources on the
command line. Errors in files that it fails to find the source code for
come out un-annotated. If I had included /usr/local/lib/ocaml in the
list of directories on the command line, the locations in the library
files would have been found, too.

    tools $ ./ocamlerror ../src ../lua < trace.txt 
    Fatal error: uncaught exception Assert_failure("cfg3.ml", 17778, 17790) (cfg3.nw: 1475, column 7)
    Raised at unknown location
    Called from module Set, character 8365
    Called from module Set, character 8360
    Called from module Set, character 8360
    Called from module Set, character 8360
    Called from module Cfg3, character 31510 (cfg3.nw: 580, column 126)
    Called from module Astasm, character 4745 (astasm.nw: 244, column 33)
    Called from module List, character 1783
    Called from module List, character 1783
    Called from module Ast3ir, character 30374 (ast3ir.nw: 1168, column 222)
    Called from module Luavalue, character 10485 (luavalue.nw: 390, column 7)
    Called from module Luainterp, character 3637 (luainterp.nw: 185, column 23)
    Called from module Luainterp, character 13688 (luainterp.nw: 466, column 22)
    Called from module Luainterp, character 14603 (luainterp.nw: 495, column 23)
    Re-raised at module Luainterp, character 14629 (luainterp.nw: 495, column 49)
    Called from module Luainterp, character 3637 (luainterp.nw: 185, column 23)
    Called from module Luabaselib, character 683 (luabaselib.nw: 83, column 16)
    Called from module Luainterp, character 14603 (luainterp.nw: 495, column 23)
    Re-raised at module Luainterp, character 14629 (luainterp.nw: 495, column 49)
    Called from module Main2, character 3219 (main2.nw: 156, column 42)
    Called from module List, character 1783
    Called from module Main2, character 4056 (main2.nw: 175, column 24)
    Called from module Main2, character 4324 (main2.nw: 190, column 9)


The tool is part of a larger project and not polished for publication.
It comes with a shell script to build it, a man page and a BSD style
license. 

http://www.eecs.harvard.edu/~lindig/software/download/ocamlerror.tar.gz

Would this be useful for the next release? I could do some polishing if
people think so.

-- Christian

-- 
Christian Lindig          Harvard University - DEAS
lindig@eecs.harvard.edu   33 Oxford St, MD 242, Cambridge MA 02138
phone: +1 (617) 496-7157  http://www.eecs.harvard.edu/~lindig/
-------------------
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


  reply	other threads:[~2001-09-11 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-11  9:39 Vesa Karvonen
2001-09-11  9:51 ` David Mentre
2001-09-11 10:06   ` Markus Mottl
2001-09-13  0:14     ` SooHyoung Oh
2001-09-13  8:46       ` Markus Mottl
2001-09-11 10:53   ` Sven
2001-09-11 13:49     ` Christian Lindig [this message]
2001-09-11 14:41   ` Vesa Karvonen

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=20010911094950.B17440@lakeland.eecs.harvard.edu \
    --to=lindig@eecs.harvard.edu \
    --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;
as well as URLs for NNTP newsgroup(s).