alistair23-linux/tools/perf
Kirill Smelkov 7a2b620986 perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:

For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:

    000004ac <my_strlen>:
    int my_strlen(const char *s)
     4ac:   55                      push   %ebp
     4ad:   89 e5                   mov    %esp,%ebp
     4af:   83 ec 10                sub    $0x10,%esp
    {

i.e. we have relative-to-dso-mapping IPs (=RIP) there.

For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.

    08048604 <zz_strlen>:
    extern "C"
    int zz_strlen(const char *s)
     8048604:       55                      push   %ebp
     8048605:       89 e5                   mov    %esp,%ebp
     8048607:       83 ec 10                sub    $0x10,%esp
    {

So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.

(*) and it is - we've explicitely made it relative. Look for
    adjust_symbols handling in dso__load_sym()

Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.

The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.

To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 09:33:27 +01:00
..
bench perf sched: Fix build failure on sparc 2009-12-14 08:59:12 +01:00
Documentation perf buildid-cache: Add new command to manage build-id cache 2010-01-21 08:31:29 +01:00
scripts/perl perf trace/scripting: List available scripts 2009-12-15 10:31:32 +01:00
util perf annotate: Fix it for non-prelinked *.so 2010-02-04 09:33:27 +01:00
.gitignore perf: Ignore perf-archive temp file 2010-01-29 10:37:33 +01:00
builtin-annotate.c perf annotate: Fix it for non-prelinked *.so 2010-02-04 09:33:27 +01:00
builtin-bench.c perf bench: Add "all" pseudo subsystem and "all" pseudo suite 2009-12-14 08:51:19 +01:00
builtin-buildid-cache.c perf buildid-cache: Add new command to manage build-id cache 2010-01-21 08:31:29 +01:00
builtin-buildid-list.c perf build-id: Move the routine to find DSOs with hits to the lib 2010-02-04 09:33:26 +01:00
builtin-diff.c perf tools: Don't cast RIP to pointers 2010-01-16 10:58:45 +01:00
builtin-help.c perf: Make cmd_to_page() function more compact 2010-01-13 10:53:51 +01:00
builtin-kmem.c perf symbols: Remove perf_session usage in symbols layer 2010-02-04 09:33:24 +01:00
builtin-list.c perf list: Fix large list output by using the pager 2009-08-13 09:05:48 +02:00
builtin-lock.c perf lock: Clean up various details 2010-01-31 09:08:27 +01:00
builtin-probe.c perf probe: Don't use a perf_session instance just to resolve symbols 2010-02-04 09:33:26 +01:00
builtin-record.c perf record: Stop intercepting events, use postprocessing to get build-ids 2010-02-04 09:33:27 +01:00
builtin-report.c Merge branch 'perf/urgent' into perf/core 2010-01-29 10:36:22 +01:00
builtin-sched.c perf tools: Don't cast RIP to pointers 2010-01-16 10:58:45 +01:00
builtin-stat.c perf tools: Fix --pid option for stat 2010-01-13 10:09:08 +01:00
builtin-timechart.c Merge branch 'perf/urgent' into perf/core 2010-01-29 10:36:22 +01:00
builtin-top.c perf session: Create kernel maps in the constructor 2010-01-29 09:20:58 +01:00
builtin-trace.c perf trace: Add -i option for choosing input file 2010-01-27 13:01:34 +01:00
builtin.h perf lock: Introduce new tool "perf lock", for analyzing lock statistics 2010-01-31 09:08:26 +01:00
command-list.txt perf buildid-cache: Add new command to manage build-id cache 2010-01-21 08:31:29 +01:00
CREDITS perf_counter tools: Add CREDITS file for Git contributors 2009-06-24 19:54:29 +02:00
design.txt perf: Fix few typos + cosmetics 2010-01-13 17:39:44 +01:00
Makefile perf build-id: Move the routine to find DSOs with hits to the lib 2010-02-04 09:33:26 +01:00
perf-archive.sh perf archive: Add helper script to package files needed to do analysis 2010-01-16 10:58:49 +01:00
perf.c perf lock: Introduce new tool "perf lock", for analyzing lock statistics 2010-01-31 09:08:26 +01:00
perf.h perf tools: Allow building for ARM 2009-12-11 13:50:21 +01:00