Skip to contentSkip to conversation

perf symbols: Add path to Ubuntu kernel debuginfo file

PATCH In review Anton Blanchard 4 participants 4 messages Sep 8, 2014 – Sep 19, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf symbols: Add path to Ubuntu kernel debuginfo file

Ubuntu places the kernel debuginfo in /usr/lib/debug/boot/vmlinux-*

---

tools/perf/util/symbol.c +7 -1
Index: b/tools/perf/util/symbol.c
===================================================================
@@ -1750,7 +1750,7 @@ static int vmlinux_path__init(void)
 	struct utsname uts;
 	char bf[PATH_MAX];
 
-	vmlinux_path = malloc(sizeof(char *) * 5);
+	vmlinux_path = malloc(sizeof(char *) * 6);
 	if (vmlinux_path == NULL)
 		return -1;
 
@@ -1784,6 +1784,12 @@ static int vmlinux_path__init(void)
 		 uts.release);
 	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
 	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
+		goto out_fail;
+	++vmlinux_path__nr_entries;
+	snprintf(bf, sizeof(bf), "/usr/lib/debug/boot/vmlinux-%s",
+		 uts.release);
+	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
+	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
 		goto out_fail;
 	++vmlinux_path__nr_entries;
 
maintainer
#1 lore raw
Quoted 3 lines · Anton Blanchard

Ubuntu places the kernel debuginfo in /usr/lib/debug/boot/vmlinux-*

It seems that you need to rebase it onto current acme/perf/core as there're little change in this area. The patch itself looks good to me.

Thanks,
Namhyung

Quoted 28 lines

---

Index: b/tools/perf/util/symbol.c
===================================================================

tools/perf/util/symbol.c +7 -1
@@ -1750,7 +1750,7 @@ static int vmlinux_path__init(void)
 	struct utsname uts;
 	char bf[PATH_MAX];
 
-	vmlinux_path = malloc(sizeof(char *) * 5);
+	vmlinux_path = malloc(sizeof(char *) * 6);
 	if (vmlinux_path == NULL)
 		return -1;
 
@@ -1784,6 +1784,12 @@ static int vmlinux_path__init(void)
 		 uts.release);
 	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
 	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
+		goto out_fail;
+	++vmlinux_path__nr_entries;
+	snprintf(bf, sizeof(bf), "/usr/lib/debug/boot/vmlinux-%s",
+		 uts.release);
+	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
+	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
 		goto out_fail;
 	++vmlinux_path__nr_entries;
 
#2 lore raw

Em Fri, Sep 12, 2014 at 03:43:28PM +0900, Namhyung Kim escreveu:

Quoted 7 lines · Anton Blanchard
Quoted 3 lines

Ubuntu places the kernel debuginfo in /usr/lib/debug/boot/vmlinux-*

It seems that you need to rebase it onto current acme/perf/core as there're little change in this area. The patch itself looks good to me.

I updated the patch, to make it use the kernel_version from the perf.data file if present, else it uses uts.release as in Anton's patch, ok?

- Arnaldo

Quoted 32 lines

Thanks,
Namhyung

Quoted 28 lines

---

Index: b/tools/perf/util/symbol.c
===================================================================

tools/perf/util/symbol.c +7 -1
@@ -1750,7 +1750,7 @@ static int vmlinux_path__init(void)
 	struct utsname uts;
 	char bf[PATH_MAX];
 
-	vmlinux_path = malloc(sizeof(char *) * 5);
+	vmlinux_path = malloc(sizeof(char *) * 6);
 	if (vmlinux_path == NULL)
 		return -1;
 
@@ -1784,6 +1784,12 @@ static int vmlinux_path__init(void)
 		 uts.release);
 	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
 	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
+		goto out_fail;
+	++vmlinux_path__nr_entries;
+	snprintf(bf, sizeof(bf), "/usr/lib/debug/boot/vmlinux-%s",
+		 uts.release);
+	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
+	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
 		goto out_fail;
 	++vmlinux_path__nr_entries;
 
#3 lore raw
In reply to Anton Blanchard
perf symbols: Add path to Ubuntu kernel debuginfo file
Commit-ID:  c657f423aed0d836c807ea1d6d8d28b3914446fa
Gitweb:     http://git.kernel.org/tip/c657f423aed0d836c807ea1d6d8d28b3914446fa
Author:     Anton Blanchard <[email protected]>
AuthorDate: Mon, 15 Sep 2014 16:57:56 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 17 Sep 2014 17:08:10 -0300

perf symbols: Add path to Ubuntu kernel debuginfo file

Ubuntu places the kernel debuginfo in /usr/lib/debug/boot/vmlinux-*

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>

echo Link: http://lkml.kernel.org/n/tip-ranpwd -l 24@git.kernel.org

[ Adapted it to use the perf.data file kernel version as in 0a7e6d1b6844 ]
---
 tools/perf/util/symbol.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/util/symbol.c +7 -1
index 1adb143..be84f7a 100644
@@ -1757,7 +1757,7 @@ static int vmlinux_path__init(struct perf_session_env *env)
 	char bf[PATH_MAX];
 	char *kernel_version;
 
-	vmlinux_path = malloc(sizeof(char *) * 5);
+	vmlinux_path = malloc(sizeof(char *) * 6);
 	if (vmlinux_path == NULL)
 		return -1;
 
@@ -1788,6 +1788,12 @@ static int vmlinux_path__init(struct perf_session_env *env)
 	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
 		goto out_fail;
 	++vmlinux_path__nr_entries;
+	snprintf(bf, sizeof(bf), "/usr/lib/debug/boot/vmlinux-%s",
+		 kernel_version);
+	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
+	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
+		goto out_fail;
+        ++vmlinux_path__nr_entries;
 	snprintf(bf, sizeof(bf), "/lib/modules/%s/build/vmlinux", kernel_version);
 	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
 	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)