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 <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 831c05a commit cba04f3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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)