From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 0A6797EEB6 for ; Fri, 1 Feb 2013 13:30:31 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of edwin+ml-ocaml@etorok.net) identity=pra; client-ip=176.9.138.55; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of edwin+ml-ocaml@etorok.net designates 176.9.138.55 as permitted sender) identity=mailfrom; client-ip=176.9.138.55; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@mail.etorok.net designates 176.9.138.55 as permitted sender) identity=helo; client-ip=176.9.138.55; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="postmaster@mail.etorok.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAFAK+yC1GwCYo3/2dsb2JhbABFgmy8ORZzgh4BAQVAAQE2Ag8LGAkWDwkDAgECAUUTBgICiA4DrxaEOwEFjwEGjWODKZYXkE6CfYFkJA X-IPAS-Result: AgAFAK+yC1GwCYo3/2dsb2JhbABFgmy8ORZzgh4BAQVAAQE2Ag8LGAkWDwkDAgECAUUTBgICiA4DrxaEOwEFjwEGjWODKZYXkE6CfYFkJA X-IronPort-AV: E=Sophos;i="4.84,579,1355094000"; d="scan'208";a="989672" Received: from mail.etorok.net ([176.9.138.55]) by mail2-smtp-roc.national.inria.fr with ESMTP; 01 Feb 2013 13:30:30 +0100 Received: from [IPv6:2a02:2f09:4050:210:1e6f:65ff:fe23:db0d] (unknown [IPv6:2a02:2f09:4050:210:1e6f:65ff:fe23:db0d]) by mail.etorok.net (Postfix) with ESMTPSA id 9C6DE46B5 for ; Fri, 1 Feb 2013 13:30:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=etorok.net; s=MAILOUT; t=1359721829; bh=WdOzoHkz7KZQ2TtNREEtrzXN8P+VKNwIBJu7su0WEyk=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=H8LWOPs6b0BZsDEIiIw4ifdAu871aqzcVfnCkuScHS0e3kL5M7+SE1YZat+WYU/Wr vIAnTnHFRul1C9cEM74ewLK7ESZFrsuYXGfymvw9NmajLPrM12pRRi3SsYZi/XCihW 5tBLiYq4V83Qo+3fZAD2c1oDF44YF01DEpYsrSiw= Message-ID: <510BB565.6030101@etorok.net> Date: Fri, 01 Feb 2013 14:30:29 +0200 From: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: caml-list@inria.fr References: <104129e3.ee2.13c953b6025.Coremail.syshen@nudt.edu.cn> <20130201121152.GA1262@securactive.lan> In-Reply-To: <20130201121152.GA1262@securactive.lan> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.6 at mail X-Virus-Status: Clean Subject: Re: [Caml-list] ::how to locate the function in profile generated by gprof 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