]> Git Repo - linux.git/commit
perf annotate: Fix printing of unaugmented disassembled instructions from BPF
authorArnaldo Carvalho de Melo <[email protected]>
Tue, 6 Aug 2019 14:24:09 +0000 (11:24 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 8 Aug 2019 18:40:56 +0000 (15:40 -0300)
commit85127775a65fc58e69af0c44513937d471ccbe7b
treeff5f25a51577a5ea2a321ec800819606854a9e1e
parent6bbfe4e602691b90ac866712bd4c43c51e546a60
perf annotate: Fix printing of unaugmented disassembled instructions from BPF

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 <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Song Liu <[email protected]>
Fixes: 6987561c9e86 ("perf annotate: Enable annotation of BPF programs")
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/annotate.c
This page took 0.055517 seconds and 4 git commands to generate.