summaryrefslogtreecommitdiff
path: root/simpleperf/read_elf_test.cpp
AgeCommit message (Collapse)Author
2021-03-30simpleperf: support kernel etm data in inject cmd.Yabin Cui
Add extra info in etm_branch_list.proto to decode kernel etm data. Bug: 183135316 Test: run simpleperf_unit_test Change-Id: I165d28c4e0f3a26c09741238336949bcff3902ca
2020-11-11simpleperf: support kernel etm data in inject cmd.Yabin Cui
1. Refactor KernelDso class to handle kernel address randomization. 2. Add Dso::IpToFileOffset() to convert ip addresses to file offsets, and use special operation for KernelDso. 3. Search for vmlinux in symbol dirs. 4. Delay creating KernelDso to use the kernel build id in recording files. Bug: 172933381 Test: run simpleperf_unit_test Test: run `simpleperf inject` manually to inject kernel etm data. Change-Id: Ice7f465a6f1e870740cc8ceaf8da76220026adef
2020-07-17simpleperf: replace --include-filter with --addr-filter.Yabin Cui
Add --addr-filter to use all filter functions provided by the kernel and etm hardware. It supports: 1) starting/stopping tracing at selected instruction addresses. 2) only tracing instructions in selected addr ranges. 3) Both vaddrs in ELF files and kernel addrs can be used. Bug: 161181704 Test: run simpleperf_unit_test. Change-Id: Ie503fd0c35634a1bc006b67cc7a8faa64d58a421
2020-07-01simpleperf: Move ReadMinExecutableVaddr into ElfFile class.Yabin Cui
Bug: 160187327 Test: run simpleperf_unit_test. Change-Id: I913baff454ba01be9689712a61a970ffe04416fe
2020-06-30simpleperf: move ParseSymbols* inside ElfFile class.Yabin Cui
Bug: 160187327 Test: run simpleperf_unit_test. Change-Id: I01947eb03847cb3c5a93c7a06abb6d203f750a23
2020-06-29simpleperf: move GetBuildId* functions inside ElfFile class.Yabin Cui
Bug: 160187327 Test: run simpleperf_unit_test. Change-Id: Idd50cf755f10000e3629ec99a291ee35cf6f4cfd
2020-03-16simpleperf: add class interface to read elf files.Yabin Cui
This is to keep file mapping memory buffer. And support reading more than one content in one open instance in the future. It also supports embedded elf files in apks as normal elf files. Bug: 151665001 Test: run simpleperf_unit_test. Change-Id: Ia424926d112cbcd9970f11ffa56d047ff6df7872
2019-11-18simpleperf: exclude undefined symbols.Yabin Cui
Bug: none Test: run simpleperf_unit_test. Change-Id: I13c1e926d21897090103741744a7613b3f844c6a
2019-02-07simpleperf: fix symbolization in multi-executable-segments libraries.Yabin Cui
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
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-05-09simpleperf: change interface of read_apk.h.Yabin Cui
1. Remove GetBuildIdFromApkFile and ParseSymbolsFromApkFile, because their function can be supported using ApkInspector::FindElfInApkByName and read_elf.h. 2. Remove ApkInspector::FindOffsetInApkByName, instead the caller can use ApkInspector::FindElfInApkByName directly. 3. In ApkInspector::embedded_elf_cache_, add map for entry_name. So the EmbeddedElfs added by cmd_record.cpp can be used by OfflineUnwinder. Also support reading min executable virtual address from embedded elfs in ElfDso. Also avoid segfault reading build id of elf files with broken section table, and add test. Bug: none. Test: run simpleperf_unit_test. Change-Id: I2e4f51a5e348138cbf7445ec6dd42dbd6ae1b03d
2017-12-15simpleperf: check elf files with broken section tables.Yabin Cui
Some applications ship elf files with broken section tables. This crashes simpleperf when it tries to read symbols from the broken elf files while doing system wide profiling. So fix it by checking existence of symbol sections before reading symbols. Bug: None. Test: simpleperf_unit_test. Change-Id: If581cd2d83df55f1cadc253222d5d8242ebddafd
2016-11-14simpleperf: fix potential unaligned memory access.Yabin Cui
1. It is reported that when elf section headers are malformed, GetBuildIdFromNoteSection() aborts with SIGBUS. So fix it to accept not 4 bytes aligned section data. 2. Fix potential unaligned memory access in ConvertBytesToValue(). Test: run simpleperf_unit_test. Change-Id: I2e1612a6567978e0b526b2274377765ba2837ec2
2016-08-01simpleperf: print warning message when failed to read symbol table from elf ↵Yabin Cui
file. Change return type of read elf functions to ElfStatus, and print warning message based on situation. Add corresponding test. Bug: 29193936 Change-Id: Ie449f8be34cb579962cb73f4be3df9e4997270ca Test: run simpleperf_unit_test.
2016-07-07simpleperf: add symbol for .plt section.Yabin Cui
This avoid reporting unknown symbols when there are samples in .plt section. Bug: 28911532 Test: run simpleperf_unit_test. Change-Id: I62cb08776c99951ff845e98f0f601859d25ece5c
2016-03-18Simpleperf: support reading symbols from .gnu_debugdata.Yabin Cui
As in https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html, elf files can store mini debug information in .gnu_debugdata. Bug: 27744639 Change-Id: If4a53a4a1332824388ee309ac63a008dc5cf8d5c
2016-02-25simpleperf: port cmd_report_test to nonlinux.Yabin Cui
And fix one build_id bug introduced by previous patch. Bug: 26962895 Change-Id: Ibb8bd6ec77ee862bb01c26342d3b3024468e75b2
2016-02-17simpleperf: report symbols of native libraries in apk file.Yabin Cui
Changes included: 1. provide interface in read_apk.h to read build id and symbols. 2. report symbols of native libraries in apk file. 3. refactor code in read_elf.cpp and read_apk.cpp. 4. add verbose log. 5. add -o report_file_name option for report command. 6. add corresponding unit tests. Bug: 26962895 Change-Id: I0d5398996e0c29dba4a6f5226692b758ca096bbd
2016-02-08simpleperf: port read_apk and read_apk/read_elf tests to nonlinux.Yabin Cui
Also make following small changes: 1. Manage testdata files like libziparchive. 2. Replace StringToPid() with android::base::ParseInt(). 3. Add tests in read_elf_test. Bug: 26962895 Change-Id: I6603e9f3cea3a013e2618ea003790d102739f843
2015-12-08Simpleperf: check if elf file paths are valid before reading them.Yabin Cui
Reading invalid file paths can cause troubles. For example, reading /dev/zero can eat all memory. Bug: 25194400 Change-Id: I4de17f4f9200a43b50a4efe4c42a6fd9eaec1ba6
2015-07-06Simpleperf: check build id in report command.Yabin Cui
1. refactor BuildId type. 2. check build id before parsing symbols in report command. Bug: 22179177 Change-Id: Iefc797a88d4a168e109db786105120c8d6914369
2015-06-24Simpleperf: exclude meaningless labels in aarch64.Yabin Cui
Also remove the use of <elf.h> because of its conflicts with llvm. Bug: 19483574 Change-Id: I2cc6fcb3429aa986101e214dc39fabd920f254dd
2015-06-09Simpleperf: support symbol parsing in report command.Yabin Cui
Also fix the storage of ProcessEntry. Bug: 19483574 Change-Id: I2182a804f6ecbd28e7aa3c1a38a6f19b86f583c9