[PATCH 3.16 005/294] perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target

From: Ben Hutchings
Date: Mon Nov 06 2017 - 20:15:55 EST


3.16.50-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>

commit 80f62589fa52f530cffc50e78c0b5a2ae572d61e upstream.

When the jump instruction is displayed at the row 0 in annotate view,
the arrow is broken. An example:

16.86 â âââje 82
0.01 â movsd (%rsp),%xmm0
â movsd 0x8(%rsp),%xmm4
â movsd 0x8(%rsp),%xmm1
â movsd (%rsp),%xmm3
â divsd %xmm4,%xmm0
â divsd %xmm3,%xmm1
â movsd (%rsp),%xmm2
â addsd %xmm1,%xmm0
â addsd %xmm2,%xmm0
â movsd %xmm0,(%rsp)
â82: sub $0x1,%ebx
83.03 â â jne 38
â add $0x10,%rsp
â xor %eax,%eax
â pop %rbx
â â retq

The patch increments the row number before checking with 0.

Signed-off-by: Yao Jin <yao.jin@xxxxxxxxxxxxxxx>
Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Kan Liang <kan.liang@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Fixes: 944e1abed9e1 ("perf ui browser: Add method to draw up/down arrow line")
Link: http://lkml.kernel.org/r/1496901704-30275-1-git-send-email-yao.jin@xxxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
tools/perf/ui/browser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -670,7 +670,7 @@ static void __ui_browser__line_arrow_dow
ui_browser__gotorc(browser, row, column + 1);
SLsmg_draw_hline(2);

- if (row++ == 0)
+ if (++row == 0)
goto out;
} else
row = 0;