linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Song Liu <songliubraving@fb.com>
Subject: [PATCH 02/10] perf annotate: Fix printing of unaugmented disassembled instructions from BPF
Date: Thu,  8 Aug 2019 15:53:50 -0300	[thread overview]
Message-ID: <20190808185358.20125-3-acme@kernel.org> (raw)
In-Reply-To: <20190808185358.20125-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The code to disassemble BPF programs uses binutil's disassembling
routines, and those use in turn fprintf to print to a memstream FILE,
adding a newline at the end of each line, which ends up confusing the
TUI routines called from:

  annotate_browser__write()
    annotate_line__write()
      annotate_browser__printf()
        ui_browser__vprintf()
          SLsmg_vprintf()

The SLsmg_vprintf() function in the slang library gets confused with the
terminating newline, so make the disasm_line__parse() function that
parses the lines produced by the BPF specific disassembler (that uses
binutil's libopcodes) and the lines produced by the objdump based
disassembler used for everything else (and that doesn't adds this
terminating newline) trim the end of the line in addition of the
beginning.

This way when disasm_line->ops.raw, i.e. for instructions without a
special scnprintf() method, we'll not have that \n getting in the way of
filling the screen right after the instruction with spaces to avoid
leaving what was on the screen before and thus garbling the annotation
screen, breaking scrolling, etc.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Fixes: 6987561c9e86 ("perf annotate: Enable annotation of BPF programs")
Link: https://lkml.kernel.org/n/tip-unbr5a5efakobfr6rhxq99ta@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index ac9ad2330f93..163536720149 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1122,7 +1122,7 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
 		goto out;
 
 	(*rawp)[0] = tmp;
-	*rawp = skip_spaces(*rawp);
+	*rawp = strim(*rawp);
 
 	return 0;
 
-- 
2.21.0


  parent reply	other threads:[~2019-08-08 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 18:53 [GIT PULL] perf/urgent improvements and fixes Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 01/10] perf bench numa: Fix cpu0 binding Arnaldo Carvalho de Melo
2019-08-08 18:53 ` Arnaldo Carvalho de Melo [this message]
2019-08-08 18:53 ` [PATCH 03/10] perf db-export: Fix thread__exec_comm() Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 04/10] perf ftrace: Fix failure to set cpumask when only one cpu is present Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 05/10] perf cpumap: Fix writing to illegal memory in handling cpumap mask Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 06/10] perf tools: Fix a typo in a variable name in the Documentation Makefile Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 07/10] perf tools: Fix include paths in ui directory Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 08/10] perf record: Fix module size on s390 Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 09/10] perf annotate: Fix s390 gap between kernel end and module start Arnaldo Carvalho de Melo
2019-08-08 18:53 ` [PATCH 10/10] perf pmu-events: Fix missing "cpu_clk_unhalted.core" event 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=20190808185358.20125-3-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).