[m-rev.] for review: fix bug #67

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jul 15 12:46:36 AEST 2010


On Thu, 15 Jul 2010, Peter Wang wrote:

> An alternative fix would be to modify mprof to ignore those entries.
> ---
>
> Branches: main, 10.04
>
> Fix bug #67.
>
> runtime/mercury_prof.c:
>        Don't write out entries for do_call_closure_* and
>        do_call_class_method_* into Prof.Decl.  These produce duplicates which
>        causes mprof when trying to read it in, yet are ignored for profiling
>        anyway.
>
> diff --git a/runtime/mercury_prof.c b/runtime/mercury_prof.c
> index d64d94b..d63eb65 100644
> --- a/runtime/mercury_prof.c
> +++ b/runtime/mercury_prof.c
> @@ -292,6 +292,19 @@ print_addr_pair_node(FILE *fptr, prof_call_node *node)
> void
> MR_prof_output_addr_decl(const char *name, const MR_Code *address)
> {
> +    const char  ignore1[] = "mercury__do_call_closure_";
> +    const char  ignore2[] = "mercury__do_call_class_method_";
> +
> +    /*
> +    ** Don't output labels for do_call_closure_* and do_call_class_method_*
> +    ** as they are ignored for profiling, and the duplicates confuse mprof.
> +    */
> +    if (MR_strneq(name, ignore1, sizeof(ignore1) - 1) ||
> +        MR_strneq(name, ignore2, sizeof(ignore2) - 1))
> +    {
> +        return;
> +    }

You need to allow for an optional leading underscore, e.g.

 	_mercury__do_call_closure_
 	_mercury__do_call_class_method_

since some systems prefix symbol names in that way, e.g. Mac OS X.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list