From: Jiri Olsa <jolsa@redhat.com>
To: He Kuang <hekuang@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
alexander.shishkin@linux.intel.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf report: Don't shadow inlined symbol with different addr range
Date: Tue, 19 Feb 2019 15:02:13 +0100 [thread overview]
Message-ID: <20190219140213.GC6435@krava> (raw)
In-Reply-To: <20190219130531.15692-1-hekuang@huawei.com>
On Tue, Feb 19, 2019 at 09:05:31PM +0800, He Kuang wrote:
> We can't assume inlined symbols with the same name are equal, because
> their address range may be different. This will cause the symbols with
> different addresses be shadowed when adding to the hist entry, and lead
> to ERANGE error when checking the symbol address during sample parse, the
> addr should be within the range of [sym.start, sym.end].
>
> The error message is like: "0x36aea60 [0x8]: failed to process type: 68".
>
> The second parameter of symbol__new() is the length of the fake symbol for
> the inline frame, which is the subtraction of the end and start address of
> base_sym.
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/perf/util/sort.c | 10 ++++++++--
> tools/perf/util/srcline.c | 2 +-
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 6c1a83768eb0..d0334c33da54 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -230,8 +230,14 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
> if (sym_l == sym_r)
> return 0;
>
> - if (sym_l->inlined || sym_r->inlined)
> - return strcmp(sym_l->name, sym_r->name);
> + if (sym_l->inlined || sym_r->inlined) {
> + int ret = strcmp(sym_l->name, sym_r->name);
> +
> + if (ret)
> + return ret;
> + if ((sym_l->start <= sym_r->end) && (sym_l->end >= sym_r->start))
> + return 0;
> + }
>
> if (sym_l->start != sym_r->start)
> return (int64_t)(sym_r->start - sym_l->start);
> diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
> index dc86597d0cc4..ccf42c4e83f0 100644
> --- a/tools/perf/util/srcline.c
> +++ b/tools/perf/util/srcline.c
> @@ -104,7 +104,7 @@ static struct symbol *new_inline_sym(struct dso *dso,
> } 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->end - base_sym->start) : 0,
> base_sym ? base_sym->binding : 0,
> base_sym ? base_sym->type : 0,
> funcname);
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-02-19 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 13:05 [PATCH] perf report: Don't shadow inlined symbol with different addr range He Kuang
2019-02-19 14:02 ` Jiri Olsa [this message]
2019-02-19 15:29 ` Arnaldo Carvalho de Melo
2019-02-28 7:40 ` [tip:perf/core] " tip-bot for He Kuang
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=20190219140213.GC6435@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=hekuang@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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