From: He Kuang <hekuang@huawei.com>
To: <acme@kernel.org>, <a.p.zijlstra@chello.nl>, <mingo@redhat.com>,
<masami.hiramatsu.pt@hitachi.com>, <namhyung@kernel.org>,
<jolsa@kernel.org>
Cc: <wangnan0@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] perf probe: Enable --range option according to libdw version
Date: Wed, 1 Jul 2015 09:05:38 +0000 [thread overview]
Message-ID: <1435741539-44100-3-git-send-email-hekuang@huawei.com> (raw)
In-Reply-To: <1435741539-44100-1-git-send-email-hekuang@huawei.com>
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.
Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: He Kuang <hekuang@huawei.com>
---
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
--
1.8.5.2
next prev parent reply other threads:[~2015-07-01 9:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 9:05 [PATCH 1/4] perf record: Use %ld for long type sample counter He Kuang
2015-07-01 9:05 ` [PATCH 2/4] perf probe: Fix failure to probe online module He Kuang
2015-07-01 11:14 ` Masami Hiramatsu
2015-07-01 9:05 ` He Kuang [this message]
2015-07-01 11:02 ` [PATCH 3/4] perf probe: Enable --range option according to libdw version Masami Hiramatsu
2015-07-01 9:05 ` [PATCH 4/4] perf probe: Add failure check when show variable range He Kuang
2015-07-01 11:00 ` Masami Hiramatsu
2015-07-01 11:53 ` [PATCH v2 1/2] perf probe: Enable --range option according to libdw version He Kuang
2015-07-01 11:53 ` [PATCH v2 2/2] perf probe: Add failure check when show variable range He Kuang
2015-07-01 12:00 ` [PATCH 4/4] " 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=1435741539-44100-3-git-send-email-hekuang@huawei.com \
--to=hekuang@huawei.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
/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
all inboxes | Powered by JetHome®