aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-26 11:30:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-04-02 15:27:43 -0400
commit7e5e1b1404c30db5f6bc3f5203b6c21c1d244f99 (patch)
tree1203765ed3e60af2ba7682677ed2553c6226f058 /tools/perf/util/map.c
parentc6e718ff8cdcf5e7855077687720b37c4a07650a (diff)
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.c28
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)
268 268
269struct symbol *map_groups__find_symbol(struct map_groups *self, 269struct symbol *map_groups__find_symbol(struct map_groups *self,
270 enum map_type type, u64 addr, 270 enum map_type type, u64 addr,
271 struct map **mapp,
271 symbol_filter_t filter) 272 symbol_filter_t filter)
272{ 273{
273 struct map *map = map_groups__find(self, type, addr); 274 struct map *map = map_groups__find(self, type, addr);
274 275
275 if (map != NULL) 276 if (map != NULL) {
277 if (mapp != NULL)
278 *mapp = map;
276 return map__find_symbol(map, map->map_ip(map, addr), filter); 279 return map__find_symbol(map, map->map_ip(map, addr), filter);
280 }
281
282 return NULL;
283}
284
285struct symbol *map_groups__find_symbol_by_name(struct map_groups *self,
286 enum map_type type,
287 const char *name,
288 struct map **mapp,
289 symbol_filter_t filter)
290{
291 struct rb_node *nd;
292
293 for (nd = rb_first(&self->maps[type]); nd; nd = rb_next(nd)) {
294 struct map *pos = rb_entry(nd, struct map, rb_node);
295 struct symbol *sym = map__find_symbol_by_name(pos, name, filter);
296
297 if (sym == NULL)
298 continue;
299 if (mapp != NULL)
300 *mapp = pos;
301 return sym;
302 }
277 303
278 return NULL; 304 return NULL;
279} 305}