Commit d45868d3 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf symbols: Introduce ELF counterparts to symbol_type__is_a

For selecting the right types of symbols in ELF symtabs.
Signed-off-by: default avatarArnaldo 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: default avatarIngo Molnar <mingo@elte.hu>
parent 6893d4ee
...@@ -751,6 +751,26 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map, ...@@ -751,6 +751,26 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map,
return 0; return 0;
} }
static bool elf_sym__is_a(GElf_Sym *self, enum map_type type)
{
switch (type) {
case MAP__FUNCTION:
return elf_sym__is_function(self);
default:
return false;
}
}
static bool elf_sec__is_a(GElf_Shdr *self, Elf_Data *secstrs, enum map_type type)
{
switch (type) {
case MAP__FUNCTION:
return elf_sec__is_text(self, secstrs);
default:
return false;
}
}
static int dso__load_sym(struct dso *self, struct map *map, static int dso__load_sym(struct dso *self, struct map *map,
struct map_groups *mg, const char *name, int fd, struct map_groups *mg, const char *name, int fd,
symbol_filter_t filter, int kernel, int kmodule) symbol_filter_t filter, int kernel, int kmodule)
...@@ -825,7 +845,7 @@ static int dso__load_sym(struct dso *self, struct map *map, ...@@ -825,7 +845,7 @@ static int dso__load_sym(struct dso *self, struct map *map,
int is_label = elf_sym__is_label(&sym); int is_label = elf_sym__is_label(&sym);
const char *section_name; const char *section_name;
if (!is_label && !elf_sym__is_function(&sym)) if (!is_label && !elf_sym__is_a(&sym, map->type))
continue; continue;
sec = elf_getscn(elf, sym.st_shndx); sec = elf_getscn(elf, sym.st_shndx);
...@@ -834,7 +854,7 @@ static int dso__load_sym(struct dso *self, struct map *map, ...@@ -834,7 +854,7 @@ static int dso__load_sym(struct dso *self, struct map *map,
gelf_getshdr(sec, &shdr); gelf_getshdr(sec, &shdr);
if (is_label && !elf_sec__is_text(&shdr, secstrs)) if (is_label && !elf_sec__is_a(&shdr, secstrs, map->type))
continue; continue;
elf_name = elf_sym__name(&sym, symstrs); elf_name = elf_sym__name(&sym, symstrs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment