Commit 13e27d7686c457c625242fc2c20be30eef942408
Committed by
Arnaldo Carvalho de Melo
1 parent
36c0c588b9
Exists in
master
and in
4 other branches
perf probe: Warn when more than one line are given
Check multiple --lines option and print warning informing that only the first specified --line option is valid. Changes from the 1st post: - Accept only the first option instead of the last. - Fix warning message according to David's comment. - Mark as a bugfix. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: yrl.pp-manager.tt@hitachi.com Link: http://lkml.kernel.org/r/20110811110253.19900.96192.stgit@fedora15 Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 1 changed file with 11 additions and 3 deletions Side-by-side Diff
tools/perf/builtin-probe.c
... | ... | @@ -134,10 +134,18 @@ |
134 | 134 | { |
135 | 135 | int ret = 0; |
136 | 136 | |
137 | - if (str) | |
138 | - ret = parse_line_range_desc(str, ¶ms.line_range); | |
139 | - INIT_LIST_HEAD(¶ms.line_range.line_list); | |
137 | + if (!str) | |
138 | + return 0; | |
139 | + | |
140 | + if (params.show_lines) { | |
141 | + pr_warning("Warning: more than one --line options are" | |
142 | + " detected. Only the first one is valid.\n"); | |
143 | + return 0; | |
144 | + } | |
145 | + | |
140 | 146 | params.show_lines = true; |
147 | + ret = parse_line_range_desc(str, ¶ms.line_range); | |
148 | + INIT_LIST_HEAD(¶ms.line_range.line_list); | |
141 | 149 | |
142 | 150 | return ret; |
143 | 151 | } |