aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-02-01 23:08:28 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-02-10 15:34:13 -0300
commit40b0c5fd2455fc1e5da585f62a95eda99f7aa0b6 (patch)
tree193559843468737d1cdc6b0d50d785fdca04826c /tools/perf/util/annotate.c
parentperf inject: Try chroot directory when reading build-id (diff)
downloadlinux-dev-40b0c5fd2455fc1e5da585f62a95eda99f7aa0b6.tar.xz
linux-dev-40b0c5fd2455fc1e5da585f62a95eda99f7aa0b6.zip
perf annotate: Try chroot filename for objdump
Likewise, it should use a proper name in case the task runs under chroot. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20220202070828.143303-5-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r--tools/perf/util/annotate.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 8190a124b99d..e4c641b240df 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -33,6 +33,7 @@
#include "string2.h"
#include "util/event.h"
#include "arch/common.h"
+#include "namespaces.h"
#include <regex.h>
#include <pthread.h>
#include <linux/bitops.h>
@@ -1696,6 +1697,15 @@ fallback:
* DSO is the same as when 'perf record' ran.
*/
__symbol__join_symfs(filename, filename_size, dso->long_name);
+
+ if (access(filename, R_OK) && errno == ENOENT && dso->nsinfo) {
+ char *new_name = filename_with_chroot(dso->nsinfo->pid,
+ filename);
+ if (new_name) {
+ strlcpy(filename, new_name, filename_size);
+ free(new_name);
+ }
+ }
}
free(build_id_path);