|
@@ -2801,16 +2801,32 @@ static int find_probe_functions(struct map *map, char *name,
|
|
|
int found = 0;
|
|
|
struct symbol *sym;
|
|
|
struct rb_node *tmp;
|
|
|
+ const char *norm, *ver;
|
|
|
+ char *buf = NULL;
|
|
|
|
|
|
if (map__load(map) < 0)
|
|
|
return 0;
|
|
|
|
|
|
map__for_each_symbol(map, sym, tmp) {
|
|
|
- if (strglobmatch(sym->name, name)) {
|
|
|
+ norm = arch__normalize_symbol_name(sym->name);
|
|
|
+ if (!norm)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ /* We don't care about default symbol or not */
|
|
|
+ ver = strchr(norm, '@');
|
|
|
+ if (ver) {
|
|
|
+ buf = strndup(norm, ver - norm);
|
|
|
+ if (!buf)
|
|
|
+ return -ENOMEM;
|
|
|
+ norm = buf;
|
|
|
+ }
|
|
|
+ if (strglobmatch(norm, name)) {
|
|
|
found++;
|
|
|
if (syms && found < probe_conf.max_probes)
|
|
|
syms[found - 1] = sym;
|
|
|
}
|
|
|
+ if (buf)
|
|
|
+ zfree(&buf);
|
|
|
}
|
|
|
|
|
|
return found;
|
|
@@ -2856,7 +2872,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
|
|
|
* same name but different addresses, this lists all the symbols.
|
|
|
*/
|
|
|
num_matched_functions = find_probe_functions(map, pp->function, syms);
|
|
|
- if (num_matched_functions == 0) {
|
|
|
+ if (num_matched_functions <= 0) {
|
|
|
pr_err("Failed to find symbol %s in %s\n", pp->function,
|
|
|
pev->target ? : "kernel");
|
|
|
ret = -ENOENT;
|