From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA32705 for caml-red; Thu, 6 Jul 2000 00:16:21 +0200 (MET DST) 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 AAA10148 for ; Thu, 6 Jul 2000 00:13:54 +0200 (MET DST) Received: from csla.csl.sri.com (csla.csl.sri.com [192.12.33.2]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e65MDqX15877; Thu, 6 Jul 2000 00:13:52 +0200 (MET DST) Received: from cylinder.csl.sri.com (IDENT:filliatr@cylinder.csl.sri.com [130.107.15.112]) by csla.csl.sri.com (8.9.1/8.9.1) with ESMTP id PAA25887; Wed, 5 Jul 2000 15:13:14 -0700 (PDT) Received: (from filliatr@localhost) by cylinder.csl.sri.com (8.9.3/8.8.7) id PAA10848; Wed, 5 Jul 2000 15:13:13 -0700 X-Authentication-Warning: cylinder.csl.sri.com: filliatr set sender to filliatr@cylinder.csl.sri.com using -f From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14691.45817.315197.998898@cylinder.csl.sri.com> Date: Wed, 5 Jul 2000 15:13:13 -0700 (PDT) To: gerd@gerd-stolpmann.de Cc: John Max Skaller , Patrick M Doane , Xavier Leroy , Scott McPeak , caml-list@inria.fr Subject: Re: how to set breakpoint at exception throw? In-Reply-To: <0007042058420E.14914@ice> References: <3961F7FA.643D7863@maxtal.com.au> <0007042058420E.14914@ice> X-Mailer: VM 6.62 under Emacs 20.4.1 Reply-To: filliatr@csl.sri.com (Jean-Christophe Filliatre) Sender: weis@pauillac.inria.fr > In general, you are right; the problem is that I do not have access > to the location in the source code where the exception happened. I'm > interested in the line number and the file name of the statement > that originally caused the exception. Example: It should be easy to do with camlp4, since locations in sources are bound in the right hand sides of grammar rules. Thus, you just have to overwrite the syntax of raise so that it actually raises the exception together with its location, in an exception looking like exception LocatedException of exn * (int * int);; Then, when you want to debug your program, you compile it with camlp4 and that little extension, instead of ocamlc. I'm not expert enough in the use of camlp4 to give the code for this extension (by the way, there is no quotation for raising exception, as far as I looked in the manual) but I'm sure that's no more than two or three lines of code. And I don't know if the current file name being parsed can be accessed. Surely Daniel will be of some help here if you ask him. -- Jean-Christophe Filliatre Computer Science Laboratory Phone (650) 859-5173 SRI International FAX (650) 859-2844 333 Ravenswood Ave. email filliatr@csl.sri.com Menlo Park, CA 94025, USA web http://www.csl.sri.com/~filliatr