[PATCH v6 3/8] perf: disasm: use build_id_path if fallback failed
From: Changbin Du
Date: Wed Jul 24 2024 - 22:16:51 EST
If we can not fallback for special dso (vmlinx and vdso), use the
build_id_path found previously.
Signed-off-by: Changbin Du <changbin.du@xxxxxxxxxx>
---
tools/perf/util/disasm.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index 0ece6e06da6f..6af9fbec3a95 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -1176,15 +1176,21 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
return fallback_filename(dso, filename, filename_size);
if (dso__is_kcore(dso) || dso__is_vdso(dso))
- return fallback_filename(dso, filename, filename_size);
+ goto fallback;
- if (read_buildid_linkname(filename, linkname, sizeof(linkname) - 1) ||
- strstr(linkname, DSO__NAME_KALLSYMS) || strstr(linkname, DSO__NAME_VDSO)) {
- return fallback_filename(dso, filename, filename_size);
+ if (!read_buildid_linkname(filename, linkname, sizeof(linkname) - 1) &&
+ (!strstr(linkname, DSO__NAME_KALLSYMS) && !strstr(linkname, DSO__NAME_VDSO))) {
+ /* It's not kallsysms or vdso, use build_id path found above */
+ goto out;
}
- if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND)
- dso__set_binary_type(dso, DSO_BINARY_TYPE__BUILD_ID_CACHE);
+fallback:
+ if (fallback_filename(dso, filename, filename_size)) {
+ /* if fallback failed, use build_id path found above */
+out:
+ if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND)
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__BUILD_ID_CACHE);
+ }
return 0;
}
--
2.34.1