mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: He Kuang <hekuang@huawei.com>
To: <masami.hiramatsu.pt@hitachi.com>, <a.p.zijlstra@chello.nl>,
	<acme@kernel.org>, <jolsa@kernel.org>, <mingo@redhat.com>
Cc: <wangnan0@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] perf probe: Add flag for options when showing variables
Date: Fri, 8 May 2015 12:23:51 +0000	[thread overview]
Message-ID: <1431087832-46889-2-git-send-email-hekuang@huawei.com> (raw)
In-Reply-To: <1431087832-46889-1-git-send-email-hekuang@huawei.com>

Change current boolean flag 'externs' to unsigned long 'var_flags' for
more options related to variables. These options work with --vars only.

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/builtin-probe.c     |  8 +++++++-
 tools/perf/util/probe-event.c  | 12 ++++++------
 tools/perf/util/probe-event.h  |  3 ++-
 tools/perf/util/probe-finder.c |  6 +++---
 tools/perf/util/probe-finder.h |  9 +++++++--
 5 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 9c4cf5e..19ebe93 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -472,18 +472,24 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 			pr_err_with_code("  Error: Failed to show lines.", ret);
 		return ret;
 	case 'V':
+	{
+		unsigned long var_flags;
+
 		if (!params.filter)
 			params.filter = strfilter__new(DEFAULT_VAR_FILTER,
 						       NULL);
 
+		var_flags = params.show_ext_vars << VAR_FLAGS_EXTERN;
+
 		ret = show_available_vars(params.events, params.nevents,
 					  params.max_probe_points,
 					  params.target,
 					  params.filter,
-					  params.show_ext_vars);
+					  var_flags);
 		if (ret < 0)
 			pr_err_with_code("  Error: Failed to show vars.", ret);
 		return ret;
+	}
 #endif
 	case 'd':
 		ret = del_perf_probe_events(params.filter);
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 37a3a8b..4859656 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -824,7 +824,7 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
 static int show_available_vars_at(struct debuginfo *dinfo,
 				  struct perf_probe_event *pev,
 				  int max_vls, struct strfilter *_filter,
-				  bool externs, const char *target)
+				  unsigned long var_flags, const char *target)
 {
 	char *buf;
 	int ret, i, nvars;
@@ -839,12 +839,12 @@ static int show_available_vars_at(struct debuginfo *dinfo,
 	pr_debug("Searching variables at %s\n", buf);
 
 	ret = debuginfo__find_available_vars_at(dinfo, pev, &vls,
-						max_vls, externs);
+						max_vls, var_flags);
 	if (!ret) {  /* Not found, retry with an alternative */
 		ret = get_alternative_probe_event(dinfo, pev, &tmp, target);
 		if (!ret) {
 			ret = debuginfo__find_available_vars_at(dinfo, pev,
-						&vls, max_vls, externs);
+						&vls, max_vls, var_flags);
 			/* Release the old probe_point */
 			clear_perf_probe_point(&tmp);
 		}
@@ -892,7 +892,7 @@ end:
 /* Show available variables on given probe point */
 int show_available_vars(struct perf_probe_event *pevs, int npevs,
 			int max_vls, const char *module,
-			struct strfilter *_filter, bool externs)
+			struct strfilter *_filter, unsigned long var_flags)
 {
 	int i, ret = 0;
 	struct debuginfo *dinfo;
@@ -911,7 +911,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
 
 	for (i = 0; i < npevs && ret >= 0; i++)
 		ret = show_available_vars_at(dinfo, &pevs[i], max_vls, _filter,
-					     externs, module);
+					     var_flags, module);
 
 	debuginfo__delete(dinfo);
 out:
@@ -954,7 +954,7 @@ int show_available_vars(struct perf_probe_event *pevs __maybe_unused,
 			int npevs __maybe_unused, int max_vls __maybe_unused,
 			const char *module __maybe_unused,
 			struct strfilter *filter __maybe_unused,
-			bool externs __maybe_unused)
+			unsigned long var_flags __maybe_unused)
 {
 	pr_warning("Debuginfo-analysis is not supported.\n");
 	return -ENOSYS;
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index e10aedc..637b59e 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -132,7 +132,8 @@ extern int show_line_range(struct line_range *lr, const char *module,
 			   bool user);
 extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
 			       int max_probe_points, const char *module,
-			       struct strfilter *filter, bool externs);
+			       struct strfilter *filter,
+			       unsigned long var_flags);
 extern int show_available_funcs(const char *module, struct strfilter *filter,
 				bool user);
 bool arch__prefers_symtab(void);
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 7b645ff40..6bbdf3f 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1305,7 +1305,7 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf)
 	die_find_child(sc_die, collect_variables_cb, (void *)af, &die_mem);
 
 	/* Find external variables */
-	if (!af->externs)
+	if (!test_bit(VAR_FLAGS_EXTERN, &af->var_flags))
 		goto out;
 	/* Don't need to search child DIE for externs. */
 	af->child = false;
@@ -1328,12 +1328,12 @@ out:
 int debuginfo__find_available_vars_at(struct debuginfo *dbg,
 				      struct perf_probe_event *pev,
 				      struct variable_list **vls,
-				      int max_vls, bool externs)
+				      int max_vls, unsigned long var_flags)
 {
 	struct available_var_finder af = {
 			.pf = {.pev = pev, .callback = add_available_vars},
 			.mod = dbg->mod,
-			.max_vls = max_vls, .externs = externs};
+			.max_vls = max_vls, .var_flags = var_flags};
 	int ret;
 
 	/* Allocate result vls array */
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index f53553d..95bb79d 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -10,6 +10,10 @@
 #define MAX_PROBES		 128
 #define MAX_PROBE_ARGS		 128
 
+enum var_flags_bits {
+	VAR_FLAGS_EXTERN
+};
+
 #define PROBE_ARG_VARS		"$vars"
 #define PROBE_ARG_PARAMS	"$params"
 
@@ -56,7 +60,8 @@ extern int debuginfo__find_line_range(struct debuginfo *dbg,
 extern int debuginfo__find_available_vars_at(struct debuginfo *dbg,
 					     struct perf_probe_event *pev,
 					     struct variable_list **vls,
-					     int max_points, bool externs);
+					     int max_points,
+					     unsigned long var_flags);
 
 /* Find a src file from a DWARF tag path */
 int get_real_path(const char *raw_path, const char *comp_dir,
@@ -99,7 +104,7 @@ struct available_var_finder {
 	struct variable_list	*vls;		/* Found variable lists */
 	int			nvls;		/* Number of variable lists */
 	int			max_vls;	/* Max no. of variable lists */
-	bool			externs;	/* Find external vars too */
+	unsigned long		var_flags;	/* Variable flags */
 	bool			child;		/* Search child scopes */
 };
 
-- 
1.8.5.2


  reply	other threads:[~2015-05-08 12:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 12:23 [PATCH 1/3] perf probe: Remove length limitation for showing available variables He Kuang
2015-05-08 12:23 ` He Kuang [this message]
2015-05-08 13:15   ` [PATCH 2/3] perf probe: Add flag for options when showing variables Masami Hiramatsu
2015-05-09  6:30     ` He Kuang
2015-05-08 12:23 ` [PATCH 3/3] perf probe: Add --range option to show variable location range He Kuang
2015-05-08 14:08   ` Masami Hiramatsu
2015-05-09  7:41     ` He Kuang
2015-05-10  3:02       ` Masami Hiramatsu
2015-05-08 14:17 ` [PATCH 1/3] perf probe: Remove length limitation for showing available variables Masami Hiramatsu
2015-05-09  7:16   ` 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=1431087832-46889-2-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=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®