diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2016-07-18 12:12:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-18 18:46:34 -0400 |
commit | e70493429bb1acaad829caae01c61dd7056fe671 (patch) | |
tree | df9148b84c01f2ab1a24cfa4c1534368b316febd /tools/perf | |
parent | 9a6c582d57a0fc37fa4e13a69d9129fb3d98a401 (diff) |
perf probe: Warn unmatched function filter correctly
Warn unmatched function filter correctly instead of warning
"symbol-loading error", since that can be a filter issue.
From the technical point of view, this adds a filter chech in map__load
and if there is a filter, it returns -2 (filter-out), instead of -1
(error), and perf-probe checks it and change message.
E.g. without this fix:
# perf probe -F rt_sp*
no symbols found in [kernel.kallsyms], maybe install a debug package?
Failed to load symbols in kernel
With this fix:
# perf probe -F rt_sp*
no symbols passed the given filter.
Failed to find symbols matched to "rt_sp*"
Error: Failed to show functions.
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146885835596.16106.2293540792775552481.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/map.c | 3 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index b39b12a1208d..728129ac653a 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -312,6 +312,9 @@ int map__load(struct map *map, symbol_filter_t filter) | |||
312 | pr_warning("%.*s was updated (is prelink enabled?). " | 312 | pr_warning("%.*s was updated (is prelink enabled?). " |
313 | "Restart the long running apps that use it!\n", | 313 | "Restart the long running apps that use it!\n", |
314 | (int)real_len, name); | 314 | (int)real_len, name); |
315 | } else if (filter) { | ||
316 | pr_warning("no symbols passed the given filter.\n"); | ||
317 | return -2; /* Empty but maybe by the filter */ | ||
315 | } else { | 318 | } else { |
316 | pr_warning("no symbols found in %s, maybe install " | 319 | pr_warning("no symbols found in %s, maybe install " |
317 | "a debug package?\n", name); | 320 | "a debug package?\n", name); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index d4f8835c0a27..953dc1ab2ed7 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -3312,8 +3312,16 @@ int show_available_funcs(const char *target, struct strfilter *_filter, | |||
3312 | 3312 | ||
3313 | /* Load symbols with given filter */ | 3313 | /* Load symbols with given filter */ |
3314 | available_func_filter = _filter; | 3314 | available_func_filter = _filter; |
3315 | if (map__load(map, filter_available_functions)) { | 3315 | ret = map__load(map, filter_available_functions); |
3316 | pr_err("Failed to load symbols in %s\n", (target) ? : "kernel"); | 3316 | if (ret) { |
3317 | if (ret == -2) { | ||
3318 | char *str = strfilter__string(_filter); | ||
3319 | pr_err("Failed to find symbols matched to \"%s\"\n", | ||
3320 | str); | ||
3321 | free(str); | ||
3322 | } else | ||
3323 | pr_err("Failed to load symbols in %s\n", | ||
3324 | (target) ? : "kernel"); | ||
3317 | goto end; | 3325 | goto end; |
3318 | } | 3326 | } |
3319 | if (!dso__sorted_by_name(map->dso, map->type)) | 3327 | if (!dso__sorted_by_name(map->dso, map->type)) |