From: "Török Edwin" <edwin+ml-ocaml@etorok.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ::how to locate the function in profile generated by gprof
Date: Fri, 01 Feb 2013 14:30:29 +0200 [thread overview]
Message-ID: <510BB565.6030101@etorok.net> (raw)
In-Reply-To: <20130201121152.GA1262@securactive.lan>
On 2013-02-01 14:11, rixed@happyleptic.org wrote:
> -[ Fri, Feb 01, 2013 at 06:09:21PM +0800, ?????? ]----
>> For example, I have a module Misc, so there are function name like camlMisc__fun_1201.
>> So how can I locate the this function in source code?
>
> What I'd do is recompile the Misc module with -S to have the assembly temporary
> file and look in there camlMisc__fun_1201. First I'd note if this anonymous
> function does raise some exception or allocate some memory (it's easy to tell
> from the asm version), then I'd follow up the caller chain up to the first
> named function. Then back to the definition of this named function in misc.ml,
> I'd look for all anonymous functions available from there that have the same
> caracteristics reguarding exceptions and allocation.
>
> In case there are many anonymous functions in there or because of inlining this
> may be hard but in general it's quite easy to find out the culprit from there.
>
With OCaml 4.00.1 it might work to add -g to ocamlopt and use gdb to find out, for example:
$ ocamlopt x.ml -g -p -o x
$ gdb ./x
(gdb) b camlPrintf__fun_1770
Breakpoint 1 at 0x411ed0: file printf.ml, line 651.
--Edwin
prev parent reply other threads:[~2013-02-01 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 10:09 沈胜宇
2013-02-01 12:11 ` rixed
2013-02-01 12:30 ` Török Edwin [this message]
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=510BB565.6030101@etorok.net \
--to=edwin+ml-ocaml@etorok.net \
--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).