[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240702041837.5306-4-changbin.du@huawei.com>
Date: Tue, 2 Jul 2024 12:18:32 +0800
From: Changbin Du <changbin.du@...wei.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim
<namhyung@...nel.org>, Nathan Chancellor <nathan@...nel.org>
CC: Mark Rutland <mark.rutland@....com>, Alexander Shishkin
<alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, Ian
Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, "Liang,
Kan" <kan.liang@...ux.intel.com>, Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<llvm@...ts.linux.dev>, Hui Wang <hw.huiwang@...wei.com>, Changbin Du
<changbin.du@...wei.com>
Subject: [PATCH v5 3/8] perf: disasm: use build_id_path if fallback failed
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@...wei.com>
---
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 c4ab98c0eaa1..f4e94ff37e50 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
Powered by blists - more mailing lists