perf annotate: Add disassembly warnings for annotate --stdio
[linux-2.6-microblaze.git] / tools / perf / util / annotate.c
index abe1499..d43f6b5 100644 (file)
@@ -961,7 +961,7 @@ static int symbol__inc_addr_samples(struct map_symbol *ms,
        if (sym == NULL)
                return 0;
        src = symbol__hists(sym, evsel->evlist->core.nr_entries);
-       return src ? __symbol__inc_addr_samples(ms, src, evsel->idx, addr, sample) : 0;
+       return src ? __symbol__inc_addr_samples(ms, src, evsel->core.idx, addr, sample) : 0;
 }
 
 static int symbol__account_cycles(u64 addr, u64 start,
@@ -2159,7 +2159,7 @@ static void annotation__calc_percent(struct annotation *notes,
 
                        BUG_ON(i >= al->data_nr);
 
-                       sym_hist = annotation__histogram(notes, evsel->idx);
+                       sym_hist = annotation__histogram(notes, evsel->core.idx);
                        data = &al->data[i++];
 
                        calc_percent(sym_hist, hists, data, al->offset, end);
@@ -2192,8 +2192,10 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
                return errno;
 
        args.arch = arch = arch__find(arch_name);
-       if (arch == NULL)
+       if (arch == NULL) {
+               pr_err("%s: unsupported arch %s\n", __func__, arch_name);
                return ENOTSUP;
+       }
 
        if (parch)
                *parch = arch;
@@ -2340,7 +2342,7 @@ static void print_summary(struct rb_root *root, const char *filename)
 static void symbol__annotate_hits(struct symbol *sym, struct evsel *evsel)
 {
        struct annotation *notes = symbol__annotation(sym);
-       struct sym_hist *h = annotation__histogram(notes, evsel->idx);
+       struct sym_hist *h = annotation__histogram(notes, evsel->core.idx);
        u64 len = symbol__size(sym), offset;
 
        for (offset = 0; offset < len; ++offset)
@@ -2373,7 +2375,7 @@ int symbol__annotate_printf(struct map_symbol *ms, struct evsel *evsel,
        const char *d_filename;
        const char *evsel_name = evsel__name(evsel);
        struct annotation *notes = symbol__annotation(sym);
-       struct sym_hist *h = annotation__histogram(notes, evsel->idx);
+       struct sym_hist *h = annotation__histogram(notes, evsel->core.idx);
        struct annotation_line *pos, *queue = NULL;
        u64 start = map__rip_2objdump(map, sym->start);
        int printed = 2, queue_len = 0, addr_fmt_width;
@@ -2787,9 +2789,17 @@ int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel,
        struct rb_root source_line = RB_ROOT;
        struct hists *hists = evsel__hists(evsel);
        char buf[1024];
+       int err;
 
-       if (symbol__annotate2(ms, evsel, opts, NULL) < 0)
+       err = symbol__annotate2(ms, evsel, opts, NULL);
+       if (err) {
+               char msg[BUFSIZ];
+
+               dso->annotate_warned = true;
+               symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
+               ui__error("Couldn't annotate %s:\n%s", sym->name, msg);
                return -1;
+       }
 
        if (opts->print_lines) {
                srcline_full_filename = opts->full_path;
@@ -2813,9 +2823,17 @@ int symbol__tty_annotate(struct map_symbol *ms, struct evsel *evsel,
        struct dso *dso = ms->map->dso;
        struct symbol *sym = ms->sym;
        struct rb_root source_line = RB_ROOT;
+       int err;
+
+       err = symbol__annotate(ms, evsel, opts, NULL);
+       if (err) {
+               char msg[BUFSIZ];
 
-       if (symbol__annotate(ms, evsel, opts, NULL) < 0)
+               dso->annotate_warned = true;
+               symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
+               ui__error("Couldn't annotate %s:\n%s", sym->name, msg);
                return -1;
+       }
 
        symbol__calc_percent(sym, evsel);