Skip to contentSkip to conversation

perf annotate: Don't prepend symfs path to vmlinux path

RFC PATCH Superseded Martin Vuille 1 participant 2 messages Feb 11, 2018 perf events

lore
Share & tools
lore
#0 lore raw

cover perf annotate: Don't prepend symfs path to vmlinux path

This fix works for my use case of supplying both '--symfs' and '--vmlinux' options, and should be harmless if '--symfs' is not specified, but I suspect it could cause problems if '--symfs' is specified without '--vmlinux', as the symfs path will no longer be prepended and vmlinux may no longer be found.

Would appreciate any insights on a better approach to fix fix the issue.

Regards,
MV

#1 lore raw

RFC PATCH 1/1 perf annotate: Don't prepend symfs path to vmlinux path

When selecting the filename to pass to objdump for disassembly, if there is no entry for vmlinux in the build-id cache then the fallback code prepends symfs path to vmlinux path. If the vmlinux option was specified, this is unnecessary and, as a result, vmlinux is not found.

Don't prepend symfs path if DSO is [kernel.kallsyms]

---
 tools/perf/util/annotate.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +8 -1
index 425b7f0760ec..0b78cc4fb155 100644
@@ -1412,7 +1412,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
 		 * cache, or is just a kallsyms file, well, lets hope that this
 		 * DSO is the same as when 'perf record' ran.
 		 */
-		__symbol__join_symfs(filename, filename_size, dso->long_name);
+		if (!strstr(dso->short_name, DSO__NAME_KALLSYMS))
+		{
+			__symbol__join_symfs(filename, filename_size, dso->long_name);
+		}
+		else
+		{
+			scnprintf(filename, filename_size, "%s", dso->long_name);
+		}
 	}
 
 	free(build_id_path);
Signature · 1 line
2.13.6