diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-08-24 12:33:14 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-08-24 12:33:14 -0400 |
commit | c0b4dffbc529244d3e4e3bd392f2bffa2d8531a7 (patch) | |
tree | b38278d90267adfe41667f150c4d21283da0b91b /tools/perf/util | |
parent | 5839a5506de30c23d4cfaf49755cd294f5c48368 (diff) |
perf annotate: Reset the dso find_symbol cache when removing symbols
The 'annotate' tool does some filtering in the entries in a DSO but
forgot to reset the cache done in dso__find_symbol(), cauxing a SEGV:
[root@zoo ~]# perf annotate netlink_poll
perf: Segmentation fault
-------- backtrace --------
perf[0x526ceb]
/lib64/libc.so.6(+0x34960)[0x7faedfbe0960]
perf(rb_erase+0x223)[0x499d63]
perf[0x4213e9]
perf[0x4bc123]
perf[0x4bc621]
perf[0x4bf26b]
perf[0x4bc855]
perf(perf_session__process_events+0x340)[0x4bddc0]
perf(cmd_annotate+0x6bb)[0x421b5b]
perf[0x479063]
perf(main+0x60a)[0x42098a]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7faedfbcbfe0]
perf[0x420aa9]
[0x0]
[root@zoo ~]#
Fix it by reseting the find cache when removing symbols.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Fixes: b685ac22b436 ("perf symbols: Add front end cache for DSO symbol lookup")
Link: http://lkml.kernel.org/n/tip-b2y9x46y0t8yem1ive41zqyp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/dso.h | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index c73276db6d6f..fc8db9c764ac 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h | |||
@@ -324,6 +324,8 @@ struct dso *__dsos__findnew(struct dsos *dsos, const char *name); | |||
324 | struct dso *dsos__findnew(struct dsos *dsos, const char *name); | 324 | struct dso *dsos__findnew(struct dsos *dsos, const char *name); |
325 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); | 325 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); |
326 | 326 | ||
327 | void dso__reset_find_symbol_cache(struct dso *dso); | ||
328 | |||
327 | size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp, | 329 | size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp, |
328 | bool (skip)(struct dso *dso, int parm), int parm); | 330 | bool (skip)(struct dso *dso, int parm), int parm); |
329 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); | 331 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 42e98ab5a9bb..46ae0532a8a6 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -441,6 +441,16 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, | |||
441 | return &s->sym; | 441 | return &s->sym; |
442 | } | 442 | } |
443 | 443 | ||
444 | void dso__reset_find_symbol_cache(struct dso *dso) | ||
445 | { | ||
446 | enum map_type type; | ||
447 | |||
448 | for (type = MAP__FUNCTION; type <= MAP__VARIABLE; ++type) { | ||
449 | dso->last_find_result[type].addr = 0; | ||
450 | dso->last_find_result[type].symbol = NULL; | ||
451 | } | ||
452 | } | ||
453 | |||
444 | struct symbol *dso__find_symbol(struct dso *dso, | 454 | struct symbol *dso__find_symbol(struct dso *dso, |
445 | enum map_type type, u64 addr) | 455 | enum map_type type, u64 addr) |
446 | { | 456 | { |