linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Richter <tmricht@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org
Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com,
	Thomas Richter <tmricht@linux.vnet.ibm.com>
Subject: [PATCH] perf trace: Warn about --call-graph dwarf invalid parameters
Date: Thu, 11 Jan 2018 15:16:57 +0100	[thread overview]
Message-ID: <20180111141657.14000-1-tmricht@linux.vnet.ibm.com> (raw)

When invoking ./perf trace --call-graph fp|lbr with
additional parameters a warning is printed that these
additional comma separated parameters are silently ignored.

[root@f27 perf]# ./perf trace -vv --no-syscalls --call-graph lbr,1024
callchain: No more arguments needed for --call-graph lbr
[root@f27 perf]#

This does not happen for --call-graph dwarf,4096,4. The additional
parameter 4 is silently ignored and no warning printed.

Before:
[root@f27 perf]# ./perf trace --no-syscalls --call-graph dwarf,4096,4
Please specify something to trace.
[root@f27 perf]#

After:
[root@s35lp76 perf]# ./perf trace --no-syscalls --call-graph dwarf,4096,4
callchain: No more arguments needed for --call-graph dwarf[,xxx]
Please specify something to trace.
[root@s35lp76 perf]#

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
---
 tools/perf/util/callchain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 082505d08d72..59292d582894 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -272,6 +272,10 @@ int parse_callchain_record(const char *arg, struct callchain_param *param)
 
 				ret = get_stack_size(tok, &size);
 				param->dump_size = size;
+				if (strtok_r(NULL, ",", &saveptr)) {
+					pr_err("callchain: No more arguments "
+					       "needed for --call-graph dwarf[,xxx]\n");
+				}
 			}
 		} else if (!strncmp(name, "lbr", sizeof("lbr"))) {
 			if (!strtok_r(NULL, ",", &saveptr)) {
-- 
2.13.4

                 reply	other threads:[~2018-01-11 14:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180111141657.14000-1-tmricht@linux.vnet.ibm.com \
    --to=tmricht@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=schwidefsky@de.ibm.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;
as well as URLs for NNTP newsgroup(s).