Skip to contentSkip to conversation

perf trace: Warn about --call-graph dwarf invalid parameters

PATCH New Thomas Richter 1 participant 1 message Jan 11, 2018 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf trace: Warn about --call-graph dwarf invalid parameters

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]#

---
 tools/perf/util/callchain.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/util/callchain.c +4 -0
index 082505d08d72..59292d582894 100644
@@ -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)) {
Signature · 1 line
2.13.4