[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171005015613.GA19141@danjae.aot.lge.com>
Date: Thu, 5 Oct 2017 10:56:13 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Milian Wolff <milian.wolff@...b.com>
Cc: acme@...nel.org, jolsa@...nel.org,
Jin Yao <yao.jin@...ux.intel.com>,
Linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Jiri Olsa <jolsa@...hat.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
David Ahern <dsahern@...il.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>, kernel-team@....com
Subject: Re: [PATCH v4 03/15] perf util: refactor inline_list to operate on
symbols
Hi Milian,
On Sun, Oct 01, 2017 at 04:30:48PM +0200, Milian Wolff wrote:
> This is a requirement to create real callchain entries for inlined
> frames.
>
> Since the list of inlines usually contains the target symbol too,
> i.e. the location where the frames get inlined to, we alias that
> symbol and reuse it as-is is. This ensures that other dependent
> functionality keeps working, most notably annotation of the
> target frames.
>
> For all other entries in the inline_list, a fake symbol is created.
> These are marked by new 'inlined' member which is set to true. Only
> those symbols are managed by the inline_list and get freed when
> the inline_list is deleted from within inline_node__delete.
>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: David Ahern <dsahern@...il.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Cc: Yao Jin <yao.jin@...ux.intel.com>
> Signed-off-by: Milian Wolff <milian.wolff@...b.com>
> ---
[SNIP]
> +static struct symbol *new_inline_sym(struct dso *dso,
> + struct symbol *base_sym,
> + const char *funcname)
> +{
> + struct symbol *inline_sym;
> + char *demangled = NULL;
> +
> + if (dso) {
> + demangled = dso__demangle_sym(dso, 0, funcname);
> + if (demangled)
> + funcname = demangled;
> + }
> +
> + if (strcmp(funcname, base_sym->name) == 0) {
It seems you need to check availability of base_sym first as 'else'
statement below checks it. Or if it's guaranteed not NULL (I think
you make it so later), remove the check (and add an assert?) instead.
Thanks,
Namhyung
> + /* reuse the real, existing symbol */
> + inline_sym = base_sym;
> + /* ensure that we don't alias an inlined symbol, which could
> + * lead to double frees in inline_node__delete
> + */
> + assert(!base_sym->inlined);
> + } else {
> + /* create a fake symbol for the inline frame */
> + inline_sym = symbol__new(base_sym ? base_sym->start : 0,
> + base_sym ? base_sym->end : 0,
> + base_sym ? base_sym->binding : 0,
> + funcname);
> + if (inline_sym)
> + inline_sym->inlined = 1;
> + }
> +
> + free(demangled);
> +
> + return inline_sym;
> +}
Powered by blists - more mailing lists