OSDN Git Service

Merge tag 'perf-tools-for-v5.18-2022-03-26' of git://git.kernel.org/pub/scm/linux...
[uclinux-h8/linux.git] / tools / perf / util / annotate.c
index 8190a12..e4c641b 100644 (file)
@@ -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);