From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH -tip ] [BUGFIX] perf/probe: Fix perf probe to find correct variable DIE
Date: Thu, 29 May 2014 21:39:14 +0900 [thread overview]
Message-ID: <53872A72.6040007@hitachi.com> (raw)
In-Reply-To: <20140529121930.30879.87092.stgit@ltc230.yrl.intra.hitachi.co.jp>
Hi Arnaldo,
Here is the patch which fixes perf probe to find variable
location correctly, on the recent dwarf format. This is not
related to the SEGV issue which I fixed in previous mail.
Thank you,
(2014/05/29 21:19), Masami Hiramatsu wrote:
> Fix perf probe to find correct variable DIE which has location or
> external instance by tracking down the lexical blocks.
>
> Current die_find_variable() expects that the all variable DIEs
> which has DW_TAG_variable have a location. However, since recent
> dwarf information may have declaration variable DIEs at the
> entry of function (subprogram), die_find_variable() returns it.
>
> To solve this problem, it must track down the DIE tree to find
> a DIE which has an actual location or a reference for external
> instance.
>
> e.g. finding a DIE which origin is <0xdc73>;
>
> <1><11496>: Abbrev Number: 95 (DW_TAG_subprogram)
> <11497> DW_AT_abstract_origin: <0xdc42>
> <1149b> DW_AT_low_pc : 0x1850
> [...]
> <2><114cc>: Abbrev Number: 119 (DW_TAG_variable) <- this is a declaration
> <114cd> DW_AT_abstract_origin: <0xdc73>
> <2><114d1>: Abbrev Number: 119 (DW_TAG_variable)
> [...]
> <3><115a7>: Abbrev Number: 105 (DW_TAG_lexical_block)
> <115a8> DW_AT_ranges : 0xaa0
> <4><115ac>: Abbrev Number: 96 (DW_TAG_variable) <- this has a location
> <115ad> DW_AT_abstract_origin: <0xdc73>
> <115b1> DW_AT_location : 0x486c (location list)
>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
> tools/perf/util/dwarf-aux.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index 7defd77..cc66c40 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -747,14 +747,17 @@ struct __find_variable_param {
> static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data)
> {
> struct __find_variable_param *fvp = data;
> + Dwarf_Attribute attr;
> int tag;
>
> tag = dwarf_tag(die_mem);
> if ((tag == DW_TAG_formal_parameter ||
> tag == DW_TAG_variable) &&
> - die_compare_name(die_mem, fvp->name))
> + die_compare_name(die_mem, fvp->name) &&
> + /* Does the DIE have location information or external instance? */
> + (dwarf_attr(die_mem, DW_AT_external, &attr) ||
> + dwarf_attr(die_mem, DW_AT_location, &attr)))
> return DIE_FIND_CB_END;
> -
> if (dwarf_haspc(die_mem, fvp->addr))
> return DIE_FIND_CB_CONTINUE;
> else
>
>
>
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2014-05-29 12:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 21:44 [BUG] perf probe segfaulting when asked for variable it doesn't find Arnaldo Carvalho de Melo
2014-05-29 9:56 ` Masami Hiramatsu
2014-05-29 10:52 ` [PATCH -tip/urgent ] [BUGFIX] perf/probe: Fix a segfault if " Masami Hiramatsu
2014-05-29 11:03 ` Masami Hiramatsu
2014-05-29 12:19 ` [PATCH -tip ] [BUGFIX] perf/probe: Fix perf probe to find correct variable DIE Masami Hiramatsu
2014-05-29 12:39 ` Masami Hiramatsu [this message]
2014-05-29 13:41 ` Jiri Olsa
2014-06-03 18:29 ` Ingo Molnar
2014-05-29 13:56 ` Arnaldo Carvalho de Melo
2014-06-03 20:38 ` Arnaldo Carvalho de Melo
2014-06-04 8:25 ` Masami Hiramatsu
2014-06-04 11:31 ` Jiri Olsa
2014-06-04 12:19 ` Masami Hiramatsu
2014-06-04 12:22 ` Jiri Olsa
2014-06-03 18:56 ` Arnaldo Carvalho de Melo
2014-06-05 8:15 ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2014-05-30 6:03 ` [PATCH -tip/urgent ] [BUGFIX] perf/probe: Fix a segfault if asked for variable it doesn't find Namhyung Kim
2014-05-30 6:32 ` Masami Hiramatsu
2014-06-05 8:15 ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
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=53872A72.6040007@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.