patch 3/4 - perf_counter tools: connect module support infrastructure to symbol loading infrastructure

Mike Galbraith
2009-07-02T06:08:57+00:00

 

perf-counter tools: connect module support infrastructure to symbol loading infrastructure.


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

-Index: linux-2.6/tools/perf/util/symbol.h
===================================================================
 
 struct symbol {
 	struct rb-node	rb-node;
@@ -13,6 +14,7 @@ struct symbol {
 	u64		obj-start;
 	u64		hist-sum;
 	u64		*hist;
+	struct module	*module;
 	void		*priv;
 	char		name[0];
 };
@@ -41,7 +43,8 @@ static inline void *dso int dso@@ -35,7 +35,7 @@ static struct symbol *symbol 
 	return self;
@@ -48,8 +48,12 @@ static void symbol 		       self->start, self->end, self->name);
+	else
+		return fprintf(fp, " %llx-%llx %s t[%s]n",
+		       self->start, self->end, self->name, self->module->name);
 }
 
 struct dso *dso+	return elf-sym+					const Elf-Data *secstrs)
+{
+	return secstrs->d-buf + shdr->sh-name;
+}
+
+static inline int elf-sec 					const Elf-Data *symstrs)
 {
@@ -451,9 +475,9 @@ static int dso-	Elf-Data *symstrs;
+	Elf-Data *symstrs, *secstrs;
 	uint32-t nr-syms;
 	int err = -1;
 	uint32-t index;
@@ -461,7 +485,7 @@ static int dso 	size-t dynsym-idx;
 	int nr = 0;
@@ -520,6 +544,14 @@ static int dso+
+	secstrs = elf-getdata(sec-strndx, NULL);
+	if (symstrs == NULL)
+		goto out-elf-end;
+
 	nr-syms = shdr.sh-size / shdr.sh-entsize;
 
 	memset(&sym, 0, sizeof(sym));
@@ -529,8 +561,11 @@ static int dso 
-		if (!elf-sym 
 		gelf-getshdr(sec, &shdr);
+
+		if (is-label && !elf-sec@@ -548,6 +588,17 @@ static int dso+				sym.st-value += section->vma;
+			else {
+				fprintf(stderr, "dso 				elf-sym 			dso-	ret = dso }
 
+static int dso+		return err;
+
+	fd = open(mod->path, O-RDONLY);
+
+	if (fd < 0)
+		return err;
+
+	err = dso+{
+	struct mod-dso *mods = mod-dso+	if (err <= 0)
+		return err;
+
+	/*
+	 * Iterate over modules, and load active symbols.
+	 */
+	next = rb-first(&mods->mods);
+	while (next) {
+		pos = rb-entry(next, struct module, rb-node);
+		err = dso+
+	if (err < 0) {
+		mod-dso+static inline void dso+
+		if (prev) {
+			u64 hole = 0;
+			int alias = pos->start == prev->start;
+
+			if (!alias)
+				hole = prev->start - pos->end - 1;
+
+			if (hole || alias) {
+				if (alias)
+					pos->end = prev->end;
+				else if (hole)
+					pos->end = prev->start - 1;
+			}
+		}
+		prev = pos;
+	}
+}
+
 static int dso-	err = dso 
 	return err;
 }
 
 int dso+	if (vmlinux) {
 		err = dsoIndex: linux-2.6/tools/perf/builtin-annotate.c
===================================================================
+	err = dso+++ linux-2.6/tools/perf/builtin-report.c
@@ -188,7 +188,7 @@ static int load-kernel(void)
 	if (!kernel-dso)
 		return -1;
 
-	err = dso+	if (dsothe body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Loading


$ This page is proudly powered by www.pubbs.net, you can see more at kernel archive | Partners: ListWare Global Manufacturers