From: Dave Benjamin <dave@ramenlabs.com>
To: blue storm <bluestorm.dylc@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Name of currently executing function
Date: Mon, 14 Jul 2008 23:13:26 -0700 [thread overview]
Message-ID: <487C4006.3090008@ramenlabs.com> (raw)
In-Reply-To: <527cf6bc0807140653w6bb30b5nfa73e2e16462f181@mail.gmail.com>
blue storm wrote:
> Here is a little camlp4 code for an ad-hoc solution :
> http://bluestorm.info/camlp4/Camlp4GenericProfiler.ml
This works very well. Thank you very much for the example.
On a related note, I was trying to understand how these new syntax
filters work, and I am a bit confused by how I'm supposed to use
Camlp4Tracer. I tried compiling a simple test program with:
camlp4 -parser ocaml -filter tracer -printer ocaml
It complained about an unknown value "Debug.mode", which I figured out
was in the Camlp4 library, so I added that library and the line:
module Debug = Camlp4.Debug
to my program. Then it complained about an unbound value "exc". I looked
at the Camlp4Tracer.ml to discover that it expects an exception named
"exc" to be in scope with every function. I'm not sure what this is for,
but I was able to get it to compile by creating a toplevel variable. My
test program looks like the following now:
(*pp camlp4 -parser ocaml -filter tracer -printer ocaml *)
module Debug = Camlp4.Debug
let exc = Not_found
let test () =
print_endline "this is output"
let () =
test ()
And my Makefile looks like this:
OCAMLMAKEFILE := OCamlMakefile
SOURCES := main.ml
USE_CAMLP4 := yes
PACKS := camlp4.lib
RESULT := main
include $(OCAMLMAKEFILE)
Now, I can get tracing output:
% CAMLP4_DEBUG=* ./main
camlp4-debug: tracer: Not_found at File "main.ml", line 8, characters 16-32
this is output
So, is this the way it's supposed to work? Is this exception supposed to
be some sort of marker for logging purposes? It seems like maybe the
Printexc stuff was accidentally pasted in from the
Camlp4ExceptionTracer, but without any docs, it's hard to tell for sure.
Dave
next prev parent reply other threads:[~2008-07-15 6:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 5:27 Dave Benjamin
2008-07-14 13:53 ` [Caml-list] " blue storm
2008-07-15 6:13 ` Dave Benjamin [this message]
2008-07-20 16:17 ` Dave Benjamin
2008-07-20 17:35 ` blue storm
2008-07-20 23:41 ` Dave Benjamin
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=487C4006.3090008@ramenlabs.com \
--to=dave@ramenlabs.com \
--cc=bluestorm.dylc@gmail.com \
--cc=caml-list@yquem.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