Skip to content

Commit cba04f3

Browse files
ahunter6acmel
authored andcommitted
perf auxtrace: Fix address filter symbol name match for modules
For modules, names from kallsyms__parse() contain the module name which meant that module symbols did not match exactly by name. Fix by matching the name string up to the separating tab character. Fixes: 1b36c03 ("perf record: Add support for using symbols in address filters") Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221026072736.2982-1-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 831c05a commit cba04f3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tools/perf/util/auxtrace.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2325,11 +2325,19 @@ struct sym_args {
23252325
bool near;
23262326
};
23272327

2328+
static bool kern_sym_name_match(const char *kname, const char *name)
2329+
{
2330+
size_t n = strlen(name);
2331+
2332+
return !strcmp(kname, name) ||
2333+
(!strncmp(kname, name, n) && kname[n] == '\t');
2334+
}
2335+
23282336
static bool kern_sym_match(struct sym_args *args, const char *name, char type)
23292337
{
23302338
/* A function with the same name, and global or the n'th found or any */
23312339
return kallsyms__is_function(type) &&
2332-
!strcmp(name, args->name) &&
2340+
kern_sym_name_match(name, args->name) &&
23332341
((args->global && isupper(type)) ||
23342342
(args->selected && ++(args->cnt) == args->idx) ||
23352343
(!args->global && !args->selected));

0 commit comments

Comments
 (0)