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 <tmri...@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 via email to