From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 67919BB81 for ; Mon, 6 Mar 2006 20:53:43 +0100 (CET) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k26Jrgp3004584 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 6 Mar 2006 20:53:43 +0100 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1FGLlw-0002nC-00; Mon, 06 Mar 2006 19:53:36 +0000 Date: Mon, 6 Mar 2006 19:53:36 +0000 To: Andries Hekstra Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Line number for index out of bounds Message-ID: <20060306195336.GA9253@furbychan.cocan.org> References: <20060306111412.GA12323@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at concorde with ID 440C9346.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; stack:01 bytecode:01 ocamlc:01 stack:01 mottl's:01 notepad:01 2006:98 wrote:01 caml-list:01 exception:01 exception:01 compile:01 argument:01 argument:01 primitive:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_FAIL autolearn=disabled version=3.0.3 On Mon, Mar 06, 2006 at 08:08:02PM +0100, Andries Hekstra wrote: > If I would use this week of the trip to try this suggestion you made, how > will the stack trace give me the line number? I forgot to say that not only must you run your program in bytecode, but you must compile your program with the '-g' option. It will do something like this: $ cat test.ml let a = Array.make 10 0 let f () = a.(11) let g = f let h = g let main = h () $ ocamlc -g test.ml -o test $ ./test Fatal error: exception Invalid_argument("index out of bounds") $ OCAMLRUNPARAM=b ./test Fatal error: exception Invalid_argument("index out of bounds") Raised by primitive operation at unknown location Called from file "test.ml", line 5, character 15 As you can see, often the stack backtraces aren't very accurate either :-( You might want to look at Marcus Mottl's patch instead ... Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com