perf symbols: Better support for multiple symbol tables per dso

By using an array of rb_roots in struct dso we can, from a
struct map instance to get the right symbol rb_tree more easily.
This way we can have just one symbol lookup method for struct
map instances, map__find_symbol, instead of one per symtab type
(functions, variables).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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>
LKML-Reference: <1259346563-12568-6-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-11-27 16:29:17 -02:00
committed by Ingo Molnar
parent 3610583c29
commit 6a4694a433
7 changed files with 56 additions and 40 deletions

View File

@@ -82,8 +82,9 @@ void map__delete(struct map *self)
free(self);
}
void map__fixup_start(struct map *self, struct rb_root *symbols)
void map__fixup_start(struct map *self)
{
struct rb_root *symbols = &self->dso->symbols[self->type];
struct rb_node *nd = rb_first(symbols);
if (nd != NULL) {
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
@@ -91,8 +92,9 @@ void map__fixup_start(struct map *self, struct rb_root *symbols)
}
}
void map__fixup_end(struct map *self, struct rb_root *symbols)
void map__fixup_end(struct map *self)
{
struct rb_root *symbols = &self->dso->symbols[self->type];
struct rb_node *nd = rb_last(symbols);
if (nd != NULL) {
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
@@ -102,8 +104,8 @@ void map__fixup_end(struct map *self, struct rb_root *symbols)
#define DSO__DELETED "(deleted)"
struct symbol *map__find_function(struct map *self, u64 ip,
symbol_filter_t filter)
struct symbol *map__find_symbol(struct map *self, u64 addr,
symbol_filter_t filter)
{
if (!dso__loaded(self->dso, self->type)) {
int nr = dso__load(self->dso, self, filter);
@@ -138,7 +140,7 @@ struct symbol *map__find_function(struct map *self, u64 ip,
}
}
return self->dso->find_function(self->dso, ip);
return self->dso->find_symbol(self->dso, self->type, addr);
}
struct map *map__clone(struct map *self)