lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Jul 2010 16:41:19 +0530
From:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	Randy Dunlap <rdunlap@...otime.net>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Christoph Hellwig <hch@...radead.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Mark Wielaard <mjw@...hat.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Naren A Devaiah <naren.devaiah@...ibm.com>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	"Frank Ch. Eigler" <fche@...hat.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: [PATCHv10 2.6.35-rc6-tip 12/14]  perf: Add third parameter to symbol_filter_t.


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@...ux.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ