caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: jehenrik <jehenrik@yahoo.com>
To: caml-list@inria.fr
Subject: [Caml-list] never mind- got toplevel backtraces working
Date: Sat, 7 Sep 2002 22:12:57 -0400	[thread overview]
Message-ID: <7E2FC1D7-C2D0-11D6-9EB4-00039375801A@yahoo.com> (raw)

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


                 reply	other threads:[~2002-09-08  2:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7E2FC1D7-C2D0-11D6-9EB4-00039375801A@yahoo.com \
    --to=jehenrik@yahoo.com \
    --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).