diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-11-27 13:29:17 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-27 14:21:59 -0500 |
commit | 6a4694a433a218c729d336b348a01bfc720da095 (patch) | |
tree | 19c166d8cb244fa0ec504cd49f7de957552ce573 /tools/perf/util/map.c | |
parent | 3610583c29563e23dd038d2870f59c88438bf7a3 (diff) |
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>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 52bb4c6cf74d..69f94fe9db20 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -82,8 +82,9 @@ void map__delete(struct map *self) | |||
82 | free(self); | 82 | free(self); |
83 | } | 83 | } |
84 | 84 | ||
85 | void map__fixup_start(struct map *self, struct rb_root *symbols) | 85 | void map__fixup_start(struct map *self) |
86 | { | 86 | { |
87 | struct rb_root *symbols = &self->dso->symbols[self->type]; | ||
87 | struct rb_node *nd = rb_first(symbols); | 88 | struct rb_node *nd = rb_first(symbols); |
88 | if (nd != NULL) { | 89 | if (nd != NULL) { |
89 | struct symbol *sym = rb_entry(nd, struct symbol, rb_node); | 90 | 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) | |||
91 | } | 92 | } |
92 | } | 93 | } |
93 | 94 | ||
94 | void map__fixup_end(struct map *self, struct rb_root *symbols) | 95 | void map__fixup_end(struct map *self) |
95 | { | 96 | { |
97 | struct rb_root *symbols = &self->dso->symbols[self->type]; | ||
96 | struct rb_node *nd = rb_last(symbols); | 98 | struct rb_node *nd = rb_last(symbols); |
97 | if (nd != NULL) { | 99 | if (nd != NULL) { |
98 | struct symbol *sym = rb_entry(nd, struct symbol, rb_node); | 100 | 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) | |||
102 | 104 | ||
103 | #define DSO__DELETED "(deleted)" | 105 | #define DSO__DELETED "(deleted)" |
104 | 106 | ||
105 | struct symbol *map__find_function(struct map *self, u64 ip, | 107 | struct symbol *map__find_symbol(struct map *self, u64 addr, |
106 | symbol_filter_t filter) | 108 | symbol_filter_t filter) |
107 | { | 109 | { |
108 | if (!dso__loaded(self->dso, self->type)) { | 110 | if (!dso__loaded(self->dso, self->type)) { |
109 | int nr = dso__load(self->dso, self, filter); | 111 | int nr = dso__load(self->dso, self, filter); |
@@ -138,7 +140,7 @@ struct symbol *map__find_function(struct map *self, u64 ip, | |||
138 | } | 140 | } |
139 | } | 141 | } |
140 | 142 | ||
141 | return self->dso->find_function(self->dso, ip); | 143 | return self->dso->find_symbol(self->dso, self->type, addr); |
142 | } | 144 | } |
143 | 145 | ||
144 | struct map *map__clone(struct map *self) | 146 | struct map *map__clone(struct map *self) |