diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-08-09 13:56:13 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-08-23 14:37:33 -0400 |
commit | c12944f7faa7f76441d83c1413f13e8bc70162b2 (patch) | |
tree | c960970da851befa15ac59bb07d0f2ee629e69ea /tools/perf/util/annotate.c | |
parent | 29659ab4e7d02c08d8f2d08db0b0f708bd8b6771 (diff) |
perf disassemble: Move check for kallsyms + !kcore
We don't need to do all that filename logic to then just have to test
something unrelated and bail out, move it to the start of the function.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-lk1v4srtsktonnyp6t1o0uhx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4024d309bb00..9882bc6ac566 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1165,11 +1165,10 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map * | |||
1165 | int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) | 1165 | int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) |
1166 | { | 1166 | { |
1167 | struct dso *dso = map->dso; | 1167 | struct dso *dso = map->dso; |
1168 | char *filename = dso__build_id_filename(dso, NULL, 0); | 1168 | char *filename; |
1169 | bool free_filename = true; | 1169 | bool free_filename = true; |
1170 | char command[PATH_MAX * 2]; | 1170 | char command[PATH_MAX * 2]; |
1171 | FILE *file; | 1171 | FILE *file; |
1172 | int err = 0; | ||
1173 | char symfs_filename[PATH_MAX]; | 1172 | char symfs_filename[PATH_MAX]; |
1174 | struct kcore_extract kce; | 1173 | struct kcore_extract kce; |
1175 | bool delete_extract = false; | 1174 | bool delete_extract = false; |
@@ -1177,7 +1176,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) | |||
1177 | int lineno = 0; | 1176 | int lineno = 0; |
1178 | int nline; | 1177 | int nline; |
1179 | pid_t pid; | 1178 | pid_t pid; |
1179 | int err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX; | ||
1180 | |||
1181 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && | ||
1182 | !dso__is_kcore(dso)) | ||
1183 | goto out; | ||
1180 | 1184 | ||
1185 | filename = dso__build_id_filename(dso, NULL, 0); | ||
1181 | if (filename) | 1186 | if (filename) |
1182 | symbol__join_symfs(symfs_filename, filename); | 1187 | symbol__join_symfs(symfs_filename, filename); |
1183 | 1188 | ||
@@ -1201,12 +1206,6 @@ fallback: | |||
1201 | free_filename = false; | 1206 | free_filename = false; |
1202 | } | 1207 | } |
1203 | 1208 | ||
1204 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && | ||
1205 | !dso__is_kcore(dso)) { | ||
1206 | err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX; | ||
1207 | goto out_free_filename; | ||
1208 | } | ||
1209 | |||
1210 | pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, | 1209 | pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, |
1211 | filename, sym->name, map->unmap_ip(map, sym->start), | 1210 | filename, sym->name, map->unmap_ip(map, sym->start), |
1212 | map->unmap_ip(map, sym->end)); | 1211 | map->unmap_ip(map, sym->end)); |
@@ -1338,6 +1337,7 @@ out_free_filename: | |||
1338 | kcore_extract__delete(&kce); | 1337 | kcore_extract__delete(&kce); |
1339 | if (free_filename) | 1338 | if (free_filename) |
1340 | free(filename); | 1339 | free(filename); |
1340 | out: | ||
1341 | return err; | 1341 | return err; |
1342 | 1342 | ||
1343 | out_close_stdout: | 1343 | out_close_stdout: |