diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-12-21 20:38:37 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-12-22 17:31:59 -0500 |
commit | d3678758048308049cdad31ec3eae063be17c0db (patch) | |
tree | 717d3995a21b4b60bf949b087eabb12a7a75a51c /tools/perf/builtin-test.c | |
parent | 3b01a413c196c91040d41c86e5b56f76bb369f74 (diff) |
perf test: Look forward for symbol aliases
Not just before, fixing these false positives:
[acme@mica linux]$ perf test -v 1
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (6 entries long)
Using //lib/modules/2.6.37-rc5-00180-ge06b6bf/build/vmlinux for symbols
0xffffffff81058dc0: diff name v: sys_vm86old k: sys_ni_syscall
0xffffffff81058dc0: diff name v: sys_vm86 k: sys_ni_syscall
0xffffffff81058dc0: diff name v: sys_subpage_prot k: sys_ni_syscall
0xffffffff810b5f7c: diff name v: probe_kernel_write k: __probe_kernel_write
0xffffffff810b5fe5: diff name v: probe_kernel_read k: __probe_kernel_read
0xffffffff811bc380: diff name v: __memset k: memset
0xffffffff81384a98: diff name v: __sched_text_start k: sleep_on_common
0xffffffff81386750: diff name v: __sched_text_end k: _raw_spin_trylock
0xffffffff8138cee8: diff name v: __irqentry_text_start k: do_IRQ
0xffffffff8138f079: diff name v: __start_notes k: _etext
0xffffffff8138f079: diff name v: __stop_notes k: _etext
---- end ----
vmlinux symtab matches kallsyms: FAILED!
[acme@mica linux]$
Some are weak functions, others are just markers, etc. They get in the rb tree
with the same addr, so we need to look around to find the symbol with the same
name.
We were looking just at the previous entries with the same addr, look forward
too.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-test.c')
-rw-r--r-- | tools/perf/builtin-test.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 035b9fa063a9..e0c3f471f22d 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -119,10 +119,16 @@ static int test__vmlinux_matches_kallsyms(void) | |||
119 | * end addresses too. | 119 | * end addresses too. |
120 | */ | 120 | */ |
121 | for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) { | 121 | for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) { |
122 | struct symbol *pair; | 122 | struct symbol *pair, *first_pair; |
123 | bool backwards = true; | ||
123 | 124 | ||
124 | sym = rb_entry(nd, struct symbol, rb_node); | 125 | sym = rb_entry(nd, struct symbol, rb_node); |
125 | pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL); | 126 | |
127 | if (sym->start == sym->end) | ||
128 | continue; | ||
129 | |||
130 | first_pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL); | ||
131 | pair = first_pair; | ||
126 | 132 | ||
127 | if (pair && pair->start == sym->start) { | 133 | if (pair && pair->start == sym->start) { |
128 | next_pair: | 134 | next_pair: |
@@ -143,8 +149,10 @@ next_pair: | |||
143 | pr_debug("%#Lx: diff end addr for %s v: %#Lx k: %#Lx\n", | 149 | pr_debug("%#Lx: diff end addr for %s v: %#Lx k: %#Lx\n", |
144 | sym->start, sym->name, sym->end, pair->end); | 150 | sym->start, sym->name, sym->end, pair->end); |
145 | } else { | 151 | } else { |
146 | struct rb_node *nnd = rb_prev(&pair->rb_node); | 152 | struct rb_node *nnd; |
147 | 153 | detour: | |
154 | nnd = backwards ? rb_prev(&pair->rb_node) : | ||
155 | rb_next(&pair->rb_node); | ||
148 | if (nnd) { | 156 | if (nnd) { |
149 | struct symbol *next = rb_entry(nnd, struct symbol, rb_node); | 157 | struct symbol *next = rb_entry(nnd, struct symbol, rb_node); |
150 | 158 | ||
@@ -153,6 +161,13 @@ next_pair: | |||
153 | goto next_pair; | 161 | goto next_pair; |
154 | } | 162 | } |
155 | } | 163 | } |
164 | |||
165 | if (backwards) { | ||
166 | backwards = false; | ||
167 | pair = first_pair; | ||
168 | goto detour; | ||
169 | } | ||
170 | |||
156 | pr_debug("%#Lx: diff name v: %s k: %s\n", | 171 | pr_debug("%#Lx: diff name v: %s k: %s\n", |
157 | sym->start, sym->name, pair->name); | 172 | sym->start, sym->name, pair->name); |
158 | } | 173 | } |