From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA31734; Tue, 11 Sep 2001 15:49:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA31700 for ; Tue, 11 Sep 2001 15:49:51 +0200 (MET DST) Received: from lakeland.eecs.harvard.edu (lakeland.eecs.harvard.edu [140.247.62.173]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8BDnoL01827 for ; Tue, 11 Sep 2001 15:49:50 +0200 (MET DST) Received: by lakeland.eecs.harvard.edu (Postfix, from userid 32148) id 3721B189B1; Tue, 11 Sep 2001 09:49:50 -0400 (EDT) Date: Tue, 11 Sep 2001 09:49:50 -0400 From: Christian Lindig To: Caml Mailing List Subject: Re: [Caml-list] line number for assert Message-ID: <20010911094950.B17440@lakeland.eecs.harvard.edu> Mail-Followup-To: Christian Lindig , Caml Mailing List References: <001301c13aa5$9ffff090$422aa8c0@housemarque.fi> <20010911125325.A29665@dpt-info.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i 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 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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