diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-03-26 12:30:40 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-02 16:27:43 -0300 |
commit | 7e5e1b1404c30db5f6bc3f5203b6c21c1d244f99 (patch) | |
tree | 1203765ed3e60af2ba7682677ed2553c6226f058 /tools/perf/util/map.c | |
parent | c6e718ff8cdcf5e7855077687720b37c4a07650a (diff) | |
download | linux-stable-7e5e1b1404c30db5f6bc3f5203b6c21c1d244f99.tar.gz linux-stable-7e5e1b1404c30db5f6bc3f5203b6c21c1d244f99.tar.bz2 linux-stable-7e5e1b1404c30db5f6bc3f5203b6c21c1d244f99.zip |
perf symbols: map_groups__find_symbol must return the map too
Tools need to know from which map in the map_group a symbol was resolved
to, so that, for isntance, we can annotate kernel modules symbols by
getting its precise name, etc.
Also add the _by_name variants for completeness.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index e21f98001734..37913b241bdf 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -268,12 +268,38 @@ void map_groups__flush(struct map_groups *self) struct symbol *map_groups__find_symbol(struct map_groups *self, enum map_type type, u64 addr, + struct map **mapp, symbol_filter_t filter) { struct map *map = map_groups__find(self, type, addr); - if (map != NULL) + if (map != NULL) { + if (mapp != NULL) + *mapp = map; return map__find_symbol(map, map->map_ip(map, addr), filter); + } + + return NULL; +} + +struct symbol *map_groups__find_symbol_by_name(struct map_groups *self, + enum map_type type, + const char *name, + struct map **mapp, + symbol_filter_t filter) +{ + struct rb_node *nd; + + for (nd = rb_first(&self->maps[type]); nd; nd = rb_next(nd)) { + struct map *pos = rb_entry(nd, struct map, rb_node); + struct symbol *sym = map__find_symbol_by_name(pos, name, filter); + + if (sym == NULL) + continue; + if (mapp != NULL) + *mapp = pos; + return sym; + } return NULL; } |