Skip to contentSkip to conversation

perf trace: Do not accept --no-syscalls together with -e

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Apr 14, 2016 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  59247e33ff494e3643cdff54b64bf72575052b76
Gitweb:     http://git.kernel.org/tip/59247e33ff494e3643cdff54b64bf72575052b76
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 12 Apr 2016 16:05:02 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 13 Apr 2016 10:11:52 -0300

perf trace: Do not accept --no-syscalls together with -e

Doesn't make sense and was causing a segfault, fix it.

  # trace -e clone --no-syscalls --event sched:*exec firefox
  The -e option can't be used with --no-syscalls.
---
 tools/perf/builtin-trace.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/builtin-trace.c +7 -0
index b842ddd..d49c131 100644
@@ -3344,6 +3344,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		goto out;
 	}
 
+	err = -1;
+
 	if (trace.trace_pgfaults) {
 		trace.opts.sample_address = true;
 		trace.opts.sample_time = true;
@@ -3368,6 +3370,11 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		return -1;
 	}
 
+	if (!trace.trace_syscalls && ev_qualifier_str) {
+		pr_err("The -e option can't be used with --no-syscalls.\n");
+		goto out;
+	}
+
 	if (output_name != NULL) {
 		err = trace__open_output(&trace, output_name);
 		if (err < 0) {