Skip to contentSkip to conversation

perf symbol: Do not apply symfs for an absolute vmlinux path

PATCH Applied Namhyung Kim 4 participants 4 messages Jul 17, 2013 – Jul 19, 2013 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf symbol: Do not apply symfs for an absolute vmlinux path

From: Namhyung Kim <[email protected]>

If an user gives both of --symfs and --vmlinux option, the vmlinux will be searched under the symfs directory. This is somewhat confusing since vmlinux often lives in kernel build directory or somewhere other than user space binaries.

So it'd be better not adding symfs prefix for a vmlinux if it has an absolute pathname.

---
 tools/perf/util/symbol.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/util/symbol.c +5 -2
index d5528e1cc03a..02718e728d59 100644
@@ -888,8 +888,11 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
 	char symfs_vmlinux[PATH_MAX];
 	enum dso_binary_type symtab_type;
 
-	snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
-		 symbol_conf.symfs, vmlinux);
+	if (vmlinux[0] == '/')
+		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s", vmlinux);
+	else
+		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
+			 symbol_conf.symfs, vmlinux);
 
 	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
 		symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

If an user gives both of --symfs and --vmlinux option, the vmlinux will be searched under the symfs directory. This is somewhat confusing since vmlinux often lives in kernel build directory or somewhere other than user space binaries.

Quoted 5 lines

So it'd be better not adding symfs prefix for a vmlinux if it has an absolute pathname.

#2 lore raw

Em Wed, Jul 17, 2013 at 07:31:32AM -0600, David Ahern escreveu:

Quoted 8 lines · Namhyung Kim
Quoted 7 lines

From: Namhyung Kim <[email protected]>

If an user gives both of --symfs and --vmlinux option, the vmlinux will be searched under the symfs directory. This is somewhat confusing since vmlinux often lives in kernel build directory or somewhere other than user space binaries.

Quoted 6 lines
Quoted 5 lines

So it'd be better not adding symfs prefix for a vmlinux if it has an absolute pathname.

Thanks, applied.

- Arnaldo

#3 lore raw

[tip:perf/core] perf symbols: Do not apply symfs for an absolute vmlinux path

In reply to Namhyung Kim
perf symbols: Do not apply symfs for an absolute vmlinux path
Commit-ID:  5698d2c99ec11006b4c241ebad5252289902b358
Gitweb:     http://git.kernel.org/tip/5698d2c99ec11006b4c241ebad5252289902b358
Author:     Namhyung Kim <[email protected]>
AuthorDate: Wed, 17 Jul 2013 17:08:15 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 17 Jul 2013 12:23:57 -0300

perf symbols: Do not apply symfs for an absolute vmlinux path

If an user gives both of --symfs and --vmlinux option, the vmlinux will be searched under the symfs directory. This is somewhat confusing since vmlinux often lives in kernel build directory or somewhere other than user space binaries.

So it'd be better not adding symfs prefix for a vmlinux if it has an absolute pathname.

---
 tools/perf/util/symbol.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/util/symbol.c +5 -2
index d5528e1..02718e7 100644
@@ -888,8 +888,11 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
 	char symfs_vmlinux[PATH_MAX];
 	enum dso_binary_type symtab_type;
 
-	snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
-		 symbol_conf.symfs, vmlinux);
+	if (vmlinux[0] == '/')
+		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s", vmlinux);
+	else
+		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
+			 symbol_conf.symfs, vmlinux);
 
 	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
 		symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;