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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 29659ab4
...@@ -1165,11 +1165,10 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map * ...@@ -1165,11 +1165,10 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *
int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
{ {
struct dso *dso = map->dso; struct dso *dso = map->dso;
char *filename = dso__build_id_filename(dso, NULL, 0); char *filename;
bool free_filename = true; bool free_filename = true;
char command[PATH_MAX * 2]; char command[PATH_MAX * 2];
FILE *file; FILE *file;
int err = 0;
char symfs_filename[PATH_MAX]; char symfs_filename[PATH_MAX];
struct kcore_extract kce; struct kcore_extract kce;
bool delete_extract = false; bool delete_extract = false;
...@@ -1177,7 +1176,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) ...@@ -1177,7 +1176,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
int lineno = 0; int lineno = 0;
int nline; int nline;
pid_t pid; pid_t pid;
int err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
!dso__is_kcore(dso))
goto out;
filename = dso__build_id_filename(dso, NULL, 0);
if (filename) if (filename)
symbol__join_symfs(symfs_filename, filename); symbol__join_symfs(symfs_filename, filename);
...@@ -1201,12 +1206,6 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) ...@@ -1201,12 +1206,6 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
free_filename = false; free_filename = false;
} }
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
!dso__is_kcore(dso)) {
err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
goto out_free_filename;
}
pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
filename, sym->name, map->unmap_ip(map, sym->start), filename, sym->name, map->unmap_ip(map, sym->start),
map->unmap_ip(map, sym->end)); map->unmap_ip(map, sym->end));
...@@ -1338,6 +1337,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize) ...@@ -1338,6 +1337,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
kcore_extract__delete(&kce); kcore_extract__delete(&kce);
if (free_filename) if (free_filename)
free(filename); free(filename);
out:
return err; return err;
out_close_stdout: out_close_stdout:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment