diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-11 11:50:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-12 01:42:10 -0500 |
commit | d45868d38c1d08d50abf3e884710a938d19fa93c (patch) | |
tree | b3bb36a37780de72251dc80854d287903104e957 | |
parent | 6893d4ee67cc100348088328cac73d56f7186aa3 (diff) |
perf symbols: Introduce ELF counterparts to symbol_type__is_a
For selecting the right types of symbols in ELF symtabs.
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: <1260550239-5372-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/util/symbol.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index bb21c96e8e15..db8dc97b548b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -751,6 +751,26 @@ out: | |||
751 | return 0; | 751 | return 0; |
752 | } | 752 | } |
753 | 753 | ||
754 | static bool elf_sym__is_a(GElf_Sym *self, enum map_type type) | ||
755 | { | ||
756 | switch (type) { | ||
757 | case MAP__FUNCTION: | ||
758 | return elf_sym__is_function(self); | ||
759 | default: | ||
760 | return false; | ||
761 | } | ||
762 | } | ||
763 | |||
764 | static bool elf_sec__is_a(GElf_Shdr *self, Elf_Data *secstrs, enum map_type type) | ||
765 | { | ||
766 | switch (type) { | ||
767 | case MAP__FUNCTION: | ||
768 | return elf_sec__is_text(self, secstrs); | ||
769 | default: | ||
770 | return false; | ||
771 | } | ||
772 | } | ||
773 | |||
754 | static int dso__load_sym(struct dso *self, struct map *map, | 774 | static int dso__load_sym(struct dso *self, struct map *map, |
755 | struct map_groups *mg, const char *name, int fd, | 775 | struct map_groups *mg, const char *name, int fd, |
756 | symbol_filter_t filter, int kernel, int kmodule) | 776 | symbol_filter_t filter, int kernel, int kmodule) |
@@ -825,7 +845,7 @@ static int dso__load_sym(struct dso *self, struct map *map, | |||
825 | int is_label = elf_sym__is_label(&sym); | 845 | int is_label = elf_sym__is_label(&sym); |
826 | const char *section_name; | 846 | const char *section_name; |
827 | 847 | ||
828 | if (!is_label && !elf_sym__is_function(&sym)) | 848 | if (!is_label && !elf_sym__is_a(&sym, map->type)) |
829 | continue; | 849 | continue; |
830 | 850 | ||
831 | sec = elf_getscn(elf, sym.st_shndx); | 851 | sec = elf_getscn(elf, sym.st_shndx); |
@@ -834,7 +854,7 @@ static int dso__load_sym(struct dso *self, struct map *map, | |||
834 | 854 | ||
835 | gelf_getshdr(sec, &shdr); | 855 | gelf_getshdr(sec, &shdr); |
836 | 856 | ||
837 | if (is_label && !elf_sec__is_text(&shdr, secstrs)) | 857 | if (is_label && !elf_sec__is_a(&shdr, secstrs, map->type)) |
838 | continue; | 858 | continue; |
839 | 859 | ||
840 | elf_name = elf_sym__name(&sym, symstrs); | 860 | elf_name = elf_sym__name(&sym, symstrs); |