aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d73e8008aada..882bb864cee0 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -879,6 +879,8 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
879 FILE *file; 879 FILE *file;
880 int err = 0; 880 int err = 0;
881 char symfs_filename[PATH_MAX]; 881 char symfs_filename[PATH_MAX];
882 struct kcore_extract kce;
883 bool delete_extract = false;
882 884
883 if (filename) { 885 if (filename) {
884 snprintf(symfs_filename, sizeof(symfs_filename), "%s%s", 886 snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
@@ -940,6 +942,23 @@ fallback:
940 pr_debug("annotating [%p] %30s : [%p] %30s\n", 942 pr_debug("annotating [%p] %30s : [%p] %30s\n",
941 dso, dso->long_name, sym, sym->name); 943 dso, dso->long_name, sym, sym->name);
942 944
945 if (dso__is_kcore(dso)) {
946 kce.kcore_filename = symfs_filename;
947 kce.addr = map__rip_2objdump(map, sym->start);
948 kce.offs = sym->start;
949 kce.len = sym->end + 1 - sym->start;
950 if (!kcore_extract__create(&kce)) {
951 delete_extract = true;
952 strlcpy(symfs_filename, kce.extract_filename,
953 sizeof(symfs_filename));
954 if (free_filename) {
955 free(filename);
956 free_filename = false;
957 }
958 filename = symfs_filename;
959 }
960 }
961
943 snprintf(command, sizeof(command), 962 snprintf(command, sizeof(command),
944 "%s %s%s --start-address=0x%016" PRIx64 963 "%s %s%s --start-address=0x%016" PRIx64
945 " --stop-address=0x%016" PRIx64 964 " --stop-address=0x%016" PRIx64
@@ -972,6 +991,8 @@ fallback:
972 991
973 pclose(file); 992 pclose(file);
974out_free_filename: 993out_free_filename:
994 if (delete_extract)
995 kcore_extract__delete(&kce);
975 if (free_filename) 996 if (free_filename)
976 free(filename); 997 free(filename);
977 return err; 998 return err;