linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: acme@kernel.org, mathieu.poirier@linaro.org,
	coresight@lists.linaro.org, linux-perf-users@vger.kernel.org
Cc: leo.yan@linaro.org, suzuki.poulose@arm.com,
	mike.leach@linaro.org, James Clark <james.clark@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 3/6] perf tools: Add disassembly warnings for annotate --stdio
Date: Thu, 29 Jul 2021 16:58:02 +0100	[thread overview]
Message-ID: <20210729155805.2830-4-james.clark@arm.com> (raw)
In-Reply-To: <20210729155805.2830-1-james.clark@arm.com>

Currently 'perf annotate --stdio' (and --stdio2) will exit without
printing anything if there are disassembly errors. Apply the same
error handler that's used for TUI and GTK modes. This makes comparing
disassembly across the different modes more consistent.

Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/util/annotate.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index aa04a3655236..1ed097bcb78a 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2787,9 +2787,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;
+
+	err = symbol__annotate2(ms, evsel, opts, NULL);
+	if (err) {
+		char msg[BUFSIZ];
 
-	if (symbol__annotate2(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;
+	}
 
 	if (opts->print_lines) {
 		srcline_full_filename = opts->full_path;
@@ -2813,9 +2821,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);
 
-- 
2.28.0


  parent reply	other threads:[~2021-07-29 16:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 15:57 [RFC PATCH 0/6] perf tools: Warning fixes James Clark
2021-07-29 15:58 ` [RFC PATCH 1/6] perf tools: Add WARN_ONCE equivalent for UI warnings James Clark
2021-08-02 14:44   ` Arnaldo Carvalho de Melo
2021-07-29 15:58 ` [RFC PATCH 2/6] perf tools: Re-add annotate_warned functionality James Clark
2021-07-29 15:58 ` James Clark [this message]
2021-07-29 15:58 ` [RFC PATCH 4/6] perf tools: Add flag for tracking warnings of missing DSOs James Clark
2021-07-29 15:58 ` [RFC PATCH 5/6] perf cs-etm: Improve Coresight zero timestamp warning James Clark
2021-08-02 15:17   ` Leo Yan
2021-08-03 13:25     ` Arnaldo Carvalho de Melo
2021-07-29 15:58 ` [RFC PATCH 6/6] perf cs-etm: Add warnings for missing DSOs James Clark
2021-08-02 14:51   ` Arnaldo Carvalho de Melo
2021-08-02 17:03     ` Mathieu Poirier
2021-08-03  8:06       ` Mike Leach
2021-08-02 15:41   ` Leo Yan
2021-08-03 13:24     ` Arnaldo Carvalho de Melo
2021-08-03 14:01       ` Leo Yan
2021-08-05 12:59         ` James Clark
2021-08-06 18:36           ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729155805.2830-4-james.clark@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --subject='Re: [RFC PATCH 3/6] perf tools: Add disassembly warnings for annotate --stdio' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox