perf annotate: Resolve 'call' operands to function names
[cascardo/linux.git] / tools / perf / util / annotate.c
index aef8417..aeb5a44 100644 (file)
@@ -54,7 +54,7 @@ int ins__scnprintf(struct ins *ins, char *bf, size_t size,
        return ins__raw_scnprintf(ins, bf, size, ops);
 }
 
-static int call__parse(struct ins_operands *ops, struct map *map __maybe_unused)
+static int call__parse(struct ins_operands *ops, struct map *map)
 {
        char *endptr, *tok, *name;
 
@@ -84,7 +84,11 @@ static int call__parse(struct ins_operands *ops, struct map *map __maybe_unused)
 indirect_call:
        tok = strchr(endptr, '*');
        if (tok == NULL) {
-               ops->target.addr = 0;
+               struct symbol *sym = map__find_symbol(map, map->map_ip(map, ops->target.addr));
+               if (sym != NULL)
+                       ops->target.name = strdup(sym->name);
+               else
+                       ops->target.addr = 0;
                return 0;
        }