aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index bb21c96e8e1..db8dc97b548 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
754static 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
764static 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
754static int dso__load_sym(struct dso *self, struct map *map, 774static 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);