lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Oct 2009 16:43:02 -0400
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	lkml <linux-kernel@...r.kernel.org>
Cc:	systemtap <systemtap@...rces.redhat.com>,
	DLE <dle-develop@...ts.sourceforge.net>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Ingo Molnar <mingo@...e.hu>,
	Steven Rostedt <rostedt@...dmis.org>,
	Jim Keniston <jkenisto@...ibm.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Christoph Hellwig <hch@...radead.org>,
	"Frank Ch. Eigler" <fche@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	"H. Peter Anvin" <hpa@...or.com>, Jason Baron <jbaron@...hat.com>,
	"K.Prasad" <prasad@...ux.vnet.ibm.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Subject: [PATCH -tip perf/probes 08/10] perf/probes: Change command-line
	option of perf-probe

Change command-line option from -P to --add, and accepting probes
without --add too.

  perf probe --add "probe-define"

or, just

  perf probe "probe-define"

Signed-off-by: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Jim Keniston <jkenisto@...ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@...ibm.com>
Cc: Christoph Hellwig <hch@...radead.org>
Cc: Frank Ch. Eigler <fche@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jason Baron <jbaron@...hat.com>
Cc: K.Prasad <prasad@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
---

 tools/perf/builtin-probe.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index dcb406c..3370dab 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -65,8 +65,8 @@ static struct {
 
 #define semantic_error(msg ...) die("Semantic error :" msg)
 
-static int parse_probepoint(const struct option *opt __used,
-			    const char *str, int unset __used)
+/* Parse a probe point. Note that any error must die. */
+static void parse_probepoint(const char *str)
 {
 	char *argv[MAX_PROBE_ARGS + 2];	/* Event + probe + args */
 	int argc, i;
@@ -75,9 +75,6 @@ static int parse_probepoint(const struct option *opt __used,
 	char **event = &session.events[session.nr_probe];
 	int retp = 0;
 
-	if (!str)	/* The end of probe points */
-		return 0;
-
 	pr_debug("probe-definition(%d): %s\n", session.nr_probe, str);
 	if (++session.nr_probe == MAX_PROBES)
 		semantic_error("Too many probes");
@@ -176,6 +173,13 @@ static int parse_probepoint(const struct option *opt __used,
 		}
 
 	pr_debug("%d arguments\n", pp->nr_args);
+}
+
+static int opt_add_probepoint(const struct option *opt __used,
+			      const char *str, int unset __used)
+{
+	if (str)
+		parse_probepoint(str);
 	return 0;
 }
 
@@ -211,7 +215,8 @@ static int open_default_vmlinux(void)
 #endif
 
 static const char * const probe_usage[] = {
-	"perf probe [<options>] -P 'PROBEDEF' [-P 'PROBEDEF' ...]",
+	"perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
+	"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
 	NULL
 };
 
@@ -222,7 +227,7 @@ static const struct option options[] = {
 	OPT_STRING('k', "vmlinux", &session.vmlinux, "file",
 		"vmlinux/module pathname"),
 #endif
-	OPT_CALLBACK('P', "probe", NULL,
+	OPT_CALLBACK('a', "add", NULL,
 #ifdef NO_LIBDWARF
 		"p|r:[GRP/]NAME FUNC[+OFFS] [ARG ...]",
 #else
@@ -243,7 +248,7 @@ static const struct option options[] = {
 		"\t\tARG:\tProbe argument (local variable name or\n"
 #endif
 		"\t\t\tkprobe-tracer argument format is supported.)\n",
-		parse_probepoint),
+		opt_add_probepoint),
 	OPT_END()
 };
 
@@ -296,8 +301,11 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
 	char buf[MAX_CMDLEN];
 
 	argc = parse_options(argc, argv, options, probe_usage,
-		PARSE_OPT_STOP_AT_NON_OPTION);
-	if (argc || session.nr_probe == 0)
+			     PARSE_OPT_STOP_AT_NON_OPTION);
+	for (i = 0; i < argc; i++)
+		parse_probe_event(argv[i]);
+
+	if (session.nr_probe == 0)
 		usage_with_options(probe_usage, options);
 
 #ifdef NO_LIBDWARF


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists