Ignore the buildid of running kernel when both --outdir and --vmlinux is given and --outdir is not tracing_path, because that kernel should be off-line.
Signed-off-by: Masami Hiramatsu <mhira...@kernel.org> --- tools/perf/builtin-probe.c | 6 ++++++ tools/perf/util/symbol-elf.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 5b45ec8..773cea0 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -602,6 +602,12 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) */ symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); + /* If user gives output directory and offline vmlinux, ignore buildid */ + if (probe_conf.output_dir && symbol_conf.vmlinux_name && + strcmp(probe_conf.output_dir, tracing_path) != 0) { + symbol_conf.ignore_vmlinux_buildid = true; + } + switch (params.command) { case 'l': if (params.uprobes) { diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index a811c13..013cebf 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -685,7 +685,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, } /* Always reject images with a mismatched build-id: */ - if (dso->has_build_id) { + if (dso->has_build_id && !symbol_conf.ignore_vmlinux_buildid) { u8 build_id[BUILD_ID_SIZE]; if (elf_read_build_id(elf, build_id, BUILD_ID_SIZE) < 0) {