Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbbGALDH (ORCPT ); Wed, 1 Jul 2015 07:03:07 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:51991 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753197AbbGALDB (ORCPT ); Wed, 1 Jul 2015 07:03:01 -0400 Message-ID: <5593C8DD.30807@hitachi.com> Date: Wed, 01 Jul 2015 20:02:53 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: He Kuang , acme@kernel.org, a.p.zijlstra@chello.nl, mingo@redhat.com, namhyung@kernel.org, jolsa@kernel.org CC: wangnan0@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] perf probe: Enable --range option according to libdw version References: <1435741539-44100-1-git-send-email-hekuang@huawei.com> <1435741539-44100-3-git-send-email-hekuang@huawei.com> In-Reply-To: <1435741539-44100-3-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3400 Lines: 88 On 2015/07/01 18:05, He Kuang wrote: > The option --range uses functions in libdw (elfutils version >= 1.57), > this patch check if elfutils version meets the requirements before > enable this feature, so that perf can be built with old libdw. Is that related to any libdw bug ? or you need to use newer API? Please tell us more precise report or actual URL/bug number. Thank you, > > Reported-by: Alexei Starovoitov > Signed-off-by: He Kuang > --- > tools/perf/builtin-probe.c | 2 ++ > tools/perf/util/dwarf-aux.c | 2 ++ > tools/perf/util/dwarf-aux.h | 13 ++++++++++++- > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c > index 1272559..2760c06 100644 > --- a/tools/perf/builtin-probe.c > +++ b/tools/perf/builtin-probe.c > @@ -372,8 +372,10 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) > "Show accessible variables on PROBEDEF", opt_show_vars), > OPT_BOOLEAN('\0', "externs", &probe_conf.show_ext_vars, > "Show external variables too (with --vars only)"), > +#if _ELFUTILS_PREREQ(0, 157) > OPT_BOOLEAN('\0', "range", &probe_conf.show_location_range, > "Show variables location range in scope (with --vars only)"), > +#endif > OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, > "file", "vmlinux pathname"), > OPT_STRING('s', "source", &symbol_conf.source_prefix, > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c > index 57f3ef4..2cb4c82 100644 > --- a/tools/perf/util/dwarf-aux.c > +++ b/tools/perf/util/dwarf-aux.c > @@ -950,6 +950,7 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf) > return 0; > } > > +#if _ELFUTILS_PREREQ(0, 157) > /** > * die_get_var_innermost_scope - Get innermost scope range of given variable DIE > * @sp_die: a subprogram DIE > @@ -1071,3 +1072,4 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) > > return ret; > } > +#endif /* _ELFUTILS_PREREQ(0, 157) */ > diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h > index c42ec36..ade0c50 100644 > --- a/tools/perf/util/dwarf-aux.h > +++ b/tools/perf/util/dwarf-aux.h > @@ -125,6 +125,17 @@ extern int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf); > > /* Get the name and type of given variable DIE, stored as "type\tname" */ > extern int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf); > +#if _ELFUTILS_PREREQ(0, 157) > extern int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, > - struct strbuf *buf); > + struct strbuf *buf); > +#else > +static inline > +int die_get_var_range(Dwarf_Die *sp_die __maybe_unused, > + Dwarf_Die *vr_die __maybe_unused, > + struct strbuf *buf __maybe_unused) > +{ > + return -ENOTSUP; > +} > + > +#endif /* _ELFUTILS_PREREQ(0, 157) */ > #endif > -- Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: masami.hiramatsu.pt@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/