diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-29 15:27:18 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-08-01 17:18:16 -0400 |
commit | ee51d851392e1fe3e8be30b3c5847f34da343424 (patch) | |
tree | 995d0ca1d366d17876e5b8d32daef596941dacaa /tools/perf/ui/browsers/annotate.c | |
parent | 5cb725a9723aebb248106ff7f8c6c7253b24bbb1 (diff) |
perf annotate: Introduce strerror for handling symbol__disassemble() errors
We were just using pr_error() which makes it difficult for non stdio UIs
to provide errors using its widgets, as they need to somehow catch what
was passed to pr_error().
Fix it by introducing a __strerror() interface like the ones used
elsewhere, for instance target__strerror().
This is just the initial step, more work will be done, but first some
error handling bugs noticed while working on this need to be dealt with.
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-dgd22zl2xg7x4vcnoa83jxfb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index f4d6a8a962af..2e2d10022355 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -1026,7 +1026,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, | |||
1026 | .use_navkeypressed = true, | 1026 | .use_navkeypressed = true, |
1027 | }, | 1027 | }, |
1028 | }; | 1028 | }; |
1029 | int ret = -1; | 1029 | int ret = -1, err; |
1030 | int nr_pcnt = 1; | 1030 | int nr_pcnt = 1; |
1031 | size_t sizeof_bdl = sizeof(struct browser_disasm_line); | 1031 | size_t sizeof_bdl = sizeof(struct browser_disasm_line); |
1032 | 1032 | ||
@@ -1050,8 +1050,11 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, | |||
1050 | (nr_pcnt - 1); | 1050 | (nr_pcnt - 1); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | if (symbol__disassemble(sym, map, sizeof_bdl) < 0) { | 1053 | err = symbol__disassemble(sym, map, sizeof_bdl); |
1054 | ui__error("%s", ui_helpline__last_msg); | 1054 | if (err) { |
1055 | char msg[BUFSIZ]; | ||
1056 | symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg)); | ||
1057 | ui__error("Couldn't annotate %s:\n%s", sym->name, msg); | ||
1055 | goto out_free_offsets; | 1058 | goto out_free_offsets; |
1056 | } | 1059 | } |
1057 | 1060 | ||