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 EAA08469; Sun, 8 Sep 2002 04:10:46 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA08453 for ; Sun, 8 Sep 2002 04:10:44 +0200 (MET DST) Received: from c007.snv.cp.net (h014.c007.snv.cp.net [209.228.33.242]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g882Ah925974 for ; Sun, 8 Sep 2002 04:10:43 +0200 (MET DST) Received: (cpmta 25433 invoked from network); 7 Sep 2002 19:10:32 -0700 Received: from 65.187.194.217 (HELO localhost) by smtp.directvinternet.com (209.228.33.242) with SMTP; 7 Sep 2002 19:10:32 -0700 X-Sent: 8 Sep 2002 02:10:32 GMT Date: Sat, 7 Sep 2002 22:12:57 -0400 Mime-Version: 1.0 (Apple Message framework v482) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: [Caml-list] never mind- got toplevel backtraces working From: jehenrik To: caml-list@inria.fr Content-Transfer-Encoding: 7bit Message-Id: <7E2FC1D7-C2D0-11D6-9EB4-00039375801A@yahoo.com> X-Mailer: Apple Mail (2.482) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hmm, for getting backtraces in the toplevel, I decided to Keep It Simple Stupid, and it worked. Just hook the runtime with two external declarations and mktop. No recompiling anything: test.ml: external init_backtrace : unit -> unit = "init_backtrace" external print_exception_backtrace : unit -> unit = "print_exception_backtrace" % ocamlmktop test.ml -o testtop % testtop exception Undefined;; let foo x = if x == 7 then raise Undefined else x*x;; let rec consecutiveInts a b = if a <= b then a::(consecutiveInts (a+1) b) else [];; consecutiveInts 1 10;; Test.init_backtrace ();; try List.map foo (consecutiveInts 1 10) with _ -> Test.print_exception_backtrace (); [];; output: Called from module List, character 1656 Called from module List, character 1672 Called from module List, character 1672 Called from module List, character 1672 Called from module List, character 1672 Called from module List, character 1672 Called from module List, character 1672 - : int list = [] # ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners