Prev: Enable kdump with EFI boot
Next: [PATCHv10 2.6.35-rc6-tip 13/14] [RFC] perf: Show Potential probe points.
From: Srikar Dronamraju on 27 Jul 2010 07:20 GElf_Sym for a symbol is needed to filter out based on binding, type, value. This will be needed to list only global binding functions when listing functions from perf probe. Signed-off-by: Srikar Dronamraju <srikar(a)linux.vnet.ibm.com> --- tools/perf/builtin-test.c | 4 +++- tools/perf/builtin-top.c | 6 +++++- tools/perf/util/map.h | 4 +++- tools/perf/util/symbol.c | 10 +++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 035b9fa..31fb9e3 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c @@ -11,10 +11,12 @@ #include "util/session.h" #include "util/symbol.h" #include "util/thread.h" +#include <gelf.h> static long page_size; -static int vmlinux_matches_kallsyms_filter(struct map *map __used, struct symbol *sym) +static int vmlinux_matches_kallsyms_filter(struct map *map __used, + struct symbol *sym, GElf_Sym *gsym __used) { bool *visited = symbol__priv(sym); *visited = true; diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index b513e40..56989e8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -54,6 +54,7 @@ #include <linux/unistd.h> #include <linux/types.h> +#include <gelf.h> static int *fd[MAX_NR_CPUS][MAX_COUNTERS]; @@ -932,7 +933,10 @@ static const char *skip_symbols[] = { NULL }; -static int symbol_filter(struct map *map, struct symbol *sym) +#define __unused __attribute__((unused)) + +static int symbol_filter(struct map *map, struct symbol *sym, + GElf_Sym *gsym __unused) { struct sym_entry *syme; const char *name = sym->name; diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index f391345..1fcde24 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdbool.h> #include "types.h" +#include <gelf.h> enum map_type { MAP__FUNCTION = 0, @@ -100,7 +101,8 @@ u64 map__objdump_2ip(struct map *map, u64 addr); struct symbol; -typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); +typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym, + GElf_Sym *gsym); void map__init(struct map *self, enum map_type type, u64 start, u64 end, u64 pgoff, struct dso *dso); diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 410e824..38ad5c9 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -574,7 +574,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, ++kernel_range; } - if (filter && filter(curr_map, pos)) { + if (filter && filter(curr_map, pos, NULL)) { discard_symbol: rb_erase(&pos->rb_node, root); symbol__delete(pos); } else { @@ -653,7 +653,7 @@ static int dso__load_perf_map(struct dso *self, struct map *map, if (sym == NULL) goto out_delete_line; - if (filter && filter(map, sym)) + if (filter && filter(map, sym, NULL)) symbol__delete(sym); else { symbols__insert(&self->symbols[map->type], sym); @@ -864,7 +864,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map, if (!f) goto out_elf_end; - if (filter && filter(map, f)) + if (filter && filter(map, f, &sym)) symbol__delete(f); else { symbols__insert(&self->symbols[map->type], f); @@ -886,7 +886,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, struct map *map, if (!f) goto out_elf_end; - if (filter && filter(map, f)) + if (filter && filter(map, f, &sym)) symbol__delete(f); else { symbols__insert(&self->symbols[map->type], f); @@ -1122,7 +1122,7 @@ new_symbol: if (!f) goto out_elf_end; - if (filter && filter(curr_map, f)) + if (filter && filter(curr_map, f, &sym)) symbol__delete(f); else { symbols__insert(&curr_dso->symbols[curr_map->type], f); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |