OSDN Git Service

simpleperf: fix symbolization in multi-executable-segments libraries.
authorYabin Cui <yabinc@google.com>
Thu, 7 Feb 2019 23:06:42 +0000 (15:06 -0800)
committerYabin Cui <yabinc@google.com>
Thu, 7 Feb 2019 23:23:32 +0000 (15:23 -0800)
commitdb2c493acf984c14c16a0417e6858f0140770208
treed5f7c063dfc8b09c4f560094ea7998e989fd1ad2
parented1f0357906b3b92bc180b28a6c2fd1f9082fb67
simpleperf: fix symbolization in multi-executable-segments libraries.

Apps may run with libraries with multiple executable segments.
Symbolization ip addresses in these libraries need to use map.pgoff.

The old formula converting ip to vaddr_in_file:
  vaddr_in_file = ip - map.start + min_executable_vaddr

The new formula converting ip to vaddr_in_file:
  offset_in_file = ip - map.start + map.pgoff
  vaddr_in_file = offset_in_file - file_offset_of_min_executable_vaddr
  + min_executable_vaddr

Bug: 124056476
Test: run simpleperf_unit_test.
Test: use simpleperf to profile facebook app, ip addresses hitting libc.so
Test: and libart.so are symbolized correctly.
Change-Id: I5fd3ed822a916c4d04a9868d6d209c43ee190c5b
17 files changed:
perfprofd/symbolizer.cc
simpleperf/JITDebugReader.cpp
simpleperf/cmd_dumprecord.cpp
simpleperf/cmd_record_test.cpp
simpleperf/dso.cpp
simpleperf/dso.h
simpleperf/dso_test.cpp
simpleperf/read_elf.cpp
simpleperf/read_elf.h
simpleperf/read_elf_test.cpp
simpleperf/record_file.h
simpleperf/record_file_format.h
simpleperf/record_file_reader.cpp
simpleperf/record_file_writer.cpp
simpleperf/testdata/libc.so [new file with mode: 0644]
simpleperf/thread_tree.cpp
simpleperf/thread_tree.h