diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/probe-event.c | 23 | ||||
-rw-r--r-- | tools/perf/util/probe-event.h | 2 |
2 files changed, 14 insertions, 11 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 077e0518f0f7..9d237e3cff5d 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -1951,21 +1951,23 @@ int del_perf_probe_events(struct strlist *dellist) | |||
1951 | 1951 | ||
1952 | return ret; | 1952 | return ret; |
1953 | } | 1953 | } |
1954 | /* TODO: don't use a global variable for filter ... */ | ||
1955 | static struct strfilter *available_func_filter; | ||
1954 | 1956 | ||
1955 | /* | 1957 | /* |
1956 | * If a symbol corresponds to a function with global binding return 0. | 1958 | * If a symbol corresponds to a function with global binding and |
1957 | * For all others return 1. | 1959 | * matches filter return 0. For all others return 1. |
1958 | */ | 1960 | */ |
1959 | static int filter_non_global_functions(struct map *map __unused, | 1961 | static int filter_available_functions(struct map *map __unused, |
1960 | struct symbol *sym) | 1962 | struct symbol *sym) |
1961 | { | 1963 | { |
1962 | if (sym->binding != STB_GLOBAL) | 1964 | if (sym->binding == STB_GLOBAL && |
1963 | return 1; | 1965 | strfilter__compare(available_func_filter, sym->name)) |
1964 | 1966 | return 0; | |
1965 | return 0; | 1967 | return 1; |
1966 | } | 1968 | } |
1967 | 1969 | ||
1968 | int show_available_funcs(const char *module) | 1970 | int show_available_funcs(const char *module, struct strfilter *_filter) |
1969 | { | 1971 | { |
1970 | struct map *map; | 1972 | struct map *map; |
1971 | int ret; | 1973 | int ret; |
@@ -1981,7 +1983,8 @@ int show_available_funcs(const char *module) | |||
1981 | pr_err("Failed to find %s map.\n", (module) ? : "kernel"); | 1983 | pr_err("Failed to find %s map.\n", (module) ? : "kernel"); |
1982 | return -EINVAL; | 1984 | return -EINVAL; |
1983 | } | 1985 | } |
1984 | if (map__load(map, filter_non_global_functions)) { | 1986 | available_func_filter = _filter; |
1987 | if (map__load(map, filter_available_functions)) { | ||
1985 | pr_err("Failed to load map.\n"); | 1988 | pr_err("Failed to load map.\n"); |
1986 | return -EINVAL; | 1989 | return -EINVAL; |
1987 | } | 1990 | } |
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 4e80b2bbc516..3434fc9d79d5 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h | |||
@@ -128,7 +128,7 @@ extern int show_line_range(struct line_range *lr, const char *module); | |||
128 | extern int show_available_vars(struct perf_probe_event *pevs, int npevs, | 128 | extern int show_available_vars(struct perf_probe_event *pevs, int npevs, |
129 | int max_probe_points, const char *module, | 129 | int max_probe_points, const char *module, |
130 | struct strfilter *filter, bool externs); | 130 | struct strfilter *filter, bool externs); |
131 | extern int show_available_funcs(const char *module); | 131 | extern int show_available_funcs(const char *module, struct strfilter *filter); |
132 | 132 | ||
133 | 133 | ||
134 | /* Maximum index number of event-name postfix */ | 134 | /* Maximum index number of event-name postfix */ |