diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-03-02 12:56:12 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-23 11:49:27 -0400 |
commit | 2c7da8c590ad719796f46c875a096eb45ef971c7 (patch) | |
tree | 19a02e156fca7c96fd7a1d962fcaf17f6da7176f /tools | |
parent | bc84f464862489e687c98dea1a8ff20dc4413f93 (diff) |
perf annotate: Allow annotation for decompressed kernel modules
Decompressing kernel module file for objdump command if needed.
Annotation commands now display annotation for compressed kernel
modules.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x4jcytk2d5qjmnjvb0w75q3f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/annotate.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 61bf9128e1f2..b72086eca943 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1008,6 +1008,32 @@ fallback: | |||
1008 | } | 1008 | } |
1009 | filename = symfs_filename; | 1009 | filename = symfs_filename; |
1010 | } | 1010 | } |
1011 | } else if (dso__needs_decompress(dso)) { | ||
1012 | char tmp[PATH_MAX]; | ||
1013 | struct kmod_path m; | ||
1014 | int fd; | ||
1015 | bool ret; | ||
1016 | |||
1017 | if (kmod_path__parse_ext(&m, symfs_filename)) | ||
1018 | goto out_free_filename; | ||
1019 | |||
1020 | snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | ||
1021 | |||
1022 | fd = mkstemp(tmp); | ||
1023 | if (fd < 0) { | ||
1024 | free(m.ext); | ||
1025 | goto out_free_filename; | ||
1026 | } | ||
1027 | |||
1028 | ret = decompress_to_file(m.ext, symfs_filename, fd); | ||
1029 | |||
1030 | free(m.ext); | ||
1031 | close(fd); | ||
1032 | |||
1033 | if (!ret) | ||
1034 | goto out_free_filename; | ||
1035 | |||
1036 | strcpy(symfs_filename, tmp); | ||
1011 | } | 1037 | } |
1012 | 1038 | ||
1013 | snprintf(command, sizeof(command), | 1039 | snprintf(command, sizeof(command), |
@@ -1027,7 +1053,7 @@ fallback: | |||
1027 | 1053 | ||
1028 | file = popen(command, "r"); | 1054 | file = popen(command, "r"); |
1029 | if (!file) | 1055 | if (!file) |
1030 | goto out_free_filename; | 1056 | goto out_remove_tmp; |
1031 | 1057 | ||
1032 | while (!feof(file)) | 1058 | while (!feof(file)) |
1033 | if (symbol__parse_objdump_line(sym, map, file, privsize, | 1059 | if (symbol__parse_objdump_line(sym, map, file, privsize, |
@@ -1042,6 +1068,10 @@ fallback: | |||
1042 | delete_last_nop(sym); | 1068 | delete_last_nop(sym); |
1043 | 1069 | ||
1044 | pclose(file); | 1070 | pclose(file); |
1071 | |||
1072 | out_remove_tmp: | ||
1073 | if (dso__needs_decompress(dso)) | ||
1074 | unlink(symfs_filename); | ||
1045 | out_free_filename: | 1075 | out_free_filename: |
1046 | if (delete_extract) | 1076 | if (delete_extract) |
1047 | kcore_extract__delete(&kce); | 1077 | kcore_extract__delete(&kce); |