perf annotate browser: The idx_asm field should be used in asm only view
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 29 May 2012 23:49:14 +0000 (20:49 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 29 May 2012 23:52:38 +0000 (20:52 -0300)
When hide_src_view is true we can't use browser_disasm_line->idx, that
takes into account also non asm lines, we must use browser_disasm_line->idx_asm
instead, otherwise we may end up with an index after the number of
entries, oops, fix it.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-o1szpyjh3z87yi0n6x0cr8uu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/browsers/annotate.c

index 6e0ef79..aaf36ce 100644 (file)
@@ -300,10 +300,14 @@ static void annotate_browser__set_rb_top(struct annotate_browser *browser,
 {
        struct browser_disasm_line *bpos;
        struct disasm_line *pos;
+       u32 idx;
 
        bpos = rb_entry(nd, struct browser_disasm_line, rb_node);
        pos = ((struct disasm_line *)bpos) - 1;
-       annotate_browser__set_top(browser, pos, bpos->idx);
+       idx = bpos->idx;
+       if (browser->hide_src_code)
+               idx = bpos->idx_asm;
+       annotate_browser__set_top(browser, pos, idx);
        browser->curr_hot = nd;
 }