Skip to contentSkip to conversation

perf annotate browser: Bandaid offsets/ jump label objdump ambiguity

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Apr 27, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  97148a97baf71536e15aa0acf3310b7b1409e2f4
Gitweb:     http://git.kernel.org/tip/97148a97baf71536e15aa0acf3310b7b1409e2f4
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 20 Apr 2012 15:17:50 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 20 Apr 2012 15:17:50 -0300

perf annotate browser: Bandaid offsets/jump label objdump ambiguity

We need to cope with things like:

$ objdump  -d --no-show-raw -S -C /lib/modules/3.4.0-rc2+/build/vmlinux
<SNIP>
ffffffff8125ec60 <copy_user_generic_unrolled>:
 * Output:
 * eax uncopied bytes or 0 if successful.
 */
ENTRY(copy_user_generic_unrolled)
	CFI_STARTPROC
	cmpl $8,%edx
ffffffff8125ec60:	cmp    $0x8,%edx
	jb 20f		/* less then 8 bytes, go to byte copy loop */
ffffffff8125ec63:	jb     ffffffff8125ecf5 <copy_user_generic_unrolled+0x95>
	ALIGN_DESTINATION
<SNIP>
ffffffff8125ec8d:	je     ffffffff8125ecd9 <copy_user_generic_unrolled+0x79>
1:	movq (%rsi),%r8
ffffffff8125ec8f:	mov    (%rsi),%r8
2:	movq 1*8(%rsi),%r9
ffffffff8125ec92:	mov    0x8(%rsi),%r9
3:	movq 2*8(%rsi),%r10
ffffffff8125ec96:	mov    0x10(%rsi),%r10
4:	movq 3*8(%rsi),%r11

<SNIP>

Probably expect that the length of the addr field be the same...

Lazy move for now, back to supporting suppressing the address on callq lines...

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/ui/browsers/annotate.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
tools/perf/ui/browsers/annotate.c +9 -1
index 9c7b6d8..c2bbfc7 100644
@@ -690,7 +690,15 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
 		bpos->idx = browser.nr_entries++;
 		if (pos->offset != -1) {
 			bpos->idx_asm = browser.nr_asm_entries++;
-			browser.offsets[pos->offset] = pos;
+			/*
+			 * FIXME: short term bandaid to cope with assembly
+			 * routines that comes with labels in the same column
+			 * as the address in objdump, sigh.
+			 *
+			 * E.g. copy_user_generic_unrolled
+ 			 */
+			if (pos->offset < (s64)size)
+				browser.offsets[pos->offset] = pos;
 		} else
 			bpos->idx_asm = -1;
 	}