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.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9d9db3b296dd..7f5bdfc9bc87 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1010,6 +1010,32 @@ fallback:
1010 } 1010 }
1011 filename = symfs_filename; 1011 filename = symfs_filename;
1012 } 1012 }
1013 } else if (dso__needs_decompress(dso)) {
1014 char tmp[PATH_MAX];
1015 struct kmod_path m;
1016 int fd;
1017 bool ret;
1018
1019 if (kmod_path__parse_ext(&m, symfs_filename))
1020 goto out_free_filename;
1021
1022 snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX");
1023
1024 fd = mkstemp(tmp);
1025 if (fd < 0) {
1026 free(m.ext);
1027 goto out_free_filename;
1028 }
1029
1030 ret = decompress_to_file(m.ext, symfs_filename, fd);
1031
1032 free(m.ext);
1033 close(fd);
1034
1035 if (!ret)
1036 goto out_free_filename;
1037
1038 strcpy(symfs_filename, tmp);
1013 } 1039 }
1014 1040
1015 snprintf(command, sizeof(command), 1041 snprintf(command, sizeof(command),
@@ -1029,7 +1055,7 @@ fallback:
1029 1055
1030 file = popen(command, "r"); 1056 file = popen(command, "r");
1031 if (!file) 1057 if (!file)
1032 goto out_free_filename; 1058 goto out_remove_tmp;
1033 1059
1034 while (!feof(file)) 1060 while (!feof(file))
1035 if (symbol__parse_objdump_line(sym, map, file, privsize, 1061 if (symbol__parse_objdump_line(sym, map, file, privsize,
@@ -1044,6 +1070,10 @@ fallback:
1044 delete_last_nop(sym); 1070 delete_last_nop(sym);
1045 1071
1046 pclose(file); 1072 pclose(file);
1073
1074out_remove_tmp:
1075 if (dso__needs_decompress(dso))
1076 unlink(symfs_filename);
1047out_free_filename: 1077out_free_filename:
1048 if (delete_extract) 1078 if (delete_extract)
1049 kcore_extract__delete(&kce); 1079 kcore_extract__delete(&kce);