summaryrefslogtreecommitdiffstats
path: root/libbacktrace/backtrace_offline_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use new unwinder for offline in libbacktrace.Christopher Ferris2018-01-291-130/+73
| | | | | | | | | | | | | libbbacktrace changes: - Completely rewrite the BacktraceOffline class to use the new unwinder. - Modify the test data to save ucontext_t data instead of unw_context data. - Convert the previous tests from unw_context data to ucontext_t data. Bug: 65682279 Test: New unit tests pass in libunwindstack. Test: All offline tests continue to pass. Change-Id: I540345c304b20199d46deeb0349a0638a0f3ab2f
* Change all uintptr_t to uint64_t in API.Christopher Ferris2018-01-181-22/+21
| | | | | | | | | | | | | | | | | In order to support the offline unwinding properly, get rid of the usage of non-fixed type uintptr_t from all API calls. In addition, completely remove the old local and remote unwinding code that used libunwind. The next step will be to move the offline unwinding to the new unwinder. Bug: 65682279 Test: Ran unit tests for libbacktrace/debuggerd. Test: Ran debuggerd -b on a few arm and arm64 processes. Test: Ran crasher and crasher64 and verified tombstones look correct. Change-Id: Ib0c6cee3ad6785a102b74908a3d8e5e93e5c6b33
* libBacktraceOffline: improve unwinding callchains.Yabin Cui2017-12-181-8/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Extend MAX_BACKTRACE_FRAMES to 256, as we can have callchains with length near 256 when recording Android applications. 2. .eh_frame and .ARM.exidx doesn't know how to unwind from instructions setting up or destroying stack frames. It can lead to wrong callchains, which may contain pcs outside executable mapping areas. Stop unwinding once this is detected. 3. Some CIE entries in .eh_frame/.debug_frame suggest unwinder reading personality routine from memory. However, that is not available in offline unwinding, and leads to ACCESS_MEM_FAILED error. Work around this by returning all zero data when failed to read data for some addresses. 4. Some libraries have empty .eh_frame_hdr but valid .eh_frame. Work around this by building eh_frame_hdr manually. 5. Prefer to use .debug_frame than .eh_frame. Because the former can unwind instructions setting up and destroying stack frames. Bug: http://b/69383534 Test: run backtrace_test. Test: run simpleperf on some apps. Change-Id: I62dddda3865dd567c6be150ce5527dc2d3516256
* libbacktrace: export offline unwinding failures.Yabin Cui2017-12-151-0/+2
| | | | | | | | This is to help debugging different offline unwiding failures. Bug: http://b/69383534 Test: run backtrace_test. Change-Id: I5ed4837027a9f17d032925e97e9f5927161444b3
* libBacktraceOffline: try both .debug_frame and .ARM.exidx on arm.Yabin Cui2017-12-101-49/+19
| | | | | | | | | | | | | Currently, libBacktraceOffline doesn't try .ARM.exidx if a function appears in .debug_frame. This make it can't unwind through functions appear in both .debug_frame and .ARM.exidx, but having dwarf instructions not accepted by libunwind. This patch fixes this by trying first .debug_frame then .ARM.exidx on arm. Bug: http://b/69383534 Test: run libbacktrace_test on arm. Change-Id: Ib95dd56d5cc123a20948e880b51b28ddc04b4a6e
* Merge "libBacktraceOffline: fix using debug frame with load bias."Yabin Cui2017-12-071-0/+51
|\
| * libBacktraceOffline: fix using debug frame with load bias.Yabin Cui2017-12-061-0/+51
| | | | | | | | | | | | Bug: http://b/69383534 Test: run backtrace_test. Change-Id: I295d9dc8f3e5b628f179b2eaeac21fa93de130b0
* | Demand read load bias for a map.Christopher Ferris2017-12-051-4/+6
|/ | | | | | | | | | | | | | | | | | | Add a static GetLoadBias method to the Elf object that only reads just enough to get the load bias. Add a method to MapInfo that gets the load bias. First attempt to get it if the elf object already exists. If no elf object was created, use the new static method to get the load bias. In BacktraceMap, add a custom iterator so that when code dereferences a map element, that's when the load bias will be retrieved if it hasn't already been set. Bug: 69871050 Test: New unit tests, verify tombstones have non-zero load bias values for Test: libraries with a non-zero load bias. Change-Id: I125f4abc827589957fce2f0df24b0f25d037d732
* Update the tests.Christopher Ferris2017-08-281-34/+25
| | | | | | | | | | | | | - Change all load_base to load_bias in the test files. - Add the test files to the backtrace_test. - Add a function to get the path to the test libraries. - Change aarch64 to arm64 for offline test code. - Modify the offline tests so that they can be easily updated when unwinding on any arch for any other arch is possible. - Add tests of CreateNew for remote debugging. Test: Ran unit tests on host and angler. Change-Id: Id6c5afe73aeb2ac22463dd81f061799fcb1c178b
* Cleanup the libbacktrace interface a bit.Christopher Ferris2017-07-191-8/+8
| | | | | | | | | | | | - Change the field name load_base to load_bias (which is what it really is). - Add a rel_pc field so that callers do not need to compute it themselves. - Remove the BacktraceMap::GetRelativePc() since nobody should need to compute this themselves. Bug: 23762183 Test: Compiles and unit tests pass (debuggerd, libbacktrace). Change-Id: I2cb579767120adf08c407a58f3c487ee3f2b45fc
* libbacktraceoffline: choose correct debug section for a given address.Yabin Cui2017-02-101-44/+103
| | | | | | | | | | | | | | 1. In /system/lib/libart.so, the ranges of functions covered by .eh_frame and .ARM.exidx overlap with each other. Currently, we don't check .eh_frame if the address is in the ranges of functions covered by .ARM.exidx. It leads to a wrong unwinding result. So change the logic to first try .eh_frame and .debug_frame, if it fails, then try .ARM.exidx. 2. Add test for Item 1. Bug: http://b/35251937 Test: run backtrace_test. Change-Id: Ic412705617c300bc69b4ece178cc2e1bb3eb765b
* libbacktrace_offline: support .ARM.exidx.Yabin Cui2016-12-071-83/+235
| | | | | | | | | | | | | | | | 1. Read .ARM.exidx and .ARM.extab, provides these data to libunwind through AccessMem. 2. In FindProcInfo, search .ARM.exidx for the idx entry of function containing ip. 3. Add structures to store .ARM.exidx info in DebugFrameInfo, and clean up the structure. 4. Add tests to test each unwind information (.eh_frame, .debug_frame, .gnu_debugdata, .ARM.exidx) separately. Bug: http://b/30974693 Test: run backtrace_test. Test: run simpleperf runtest.py. Change-Id: I9377a54379158bd35860efcf0e011423be7350d4
* Fix clang-tidy performance warnings in syste/core.Chih-Hung Hsieh2016-08-011-1/+1
| | | | | | | | | | | * Use const reference type for parameters to avoid unnecessary copy. * Suppress warning of not using faster overloaded string find function. Bug: 30407689 Bug: 30411878 Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee Test: build with WITH_TIDY=1 Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
* Revert "Revert "Revert "Revert "Add BacktraceOffline for offline ↵Yabin Cui2015-09-221-0/+189
| | | | | | | | backtracing."""" This reverts commit 94ece83270deca76c69f5755f8c0ff5c859341fd. Change-Id: Ie06465c89a5fc115517130f9f2904cc855973155
* Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""Yabin Cui2015-09-221-189/+0
| | | | | | This reverts commit 0a411c934a81e5c77a27ef5b69d391038f36e969. Change-Id: Ic1824afac6c32f1087b66de9d6368a561f235d13
* Revert "Revert "Add BacktraceOffline for offline backtracing.""Yabin Cui2015-09-211-0/+189
| | | | | | | | | | | This reverts commit ab5e583327e4dfd9f7c38ab6ed4c4714508ce544. And statically link llvm libraries on host to remove dependency on 32-bit llvm shared library which is not included in the prebuilt. Bug: 22229391 Change-Id: I8210687655ee1809fd820ab2a6ca5dfaf3f9096d
* Revert "Add BacktraceOffline for offline backtracing."Yabin Cui2015-09-171-189/+0
| | | | | | | | Using llvm makes libbacktrace stops building for 32 bit on linux host x86_64. This reverts commit c9c6b6ee7735f014771d81615c0278b53d14f61c. Change-Id: Ieb807db881d7bb3132cd09e25fd08c28766ca0a8
* Add BacktraceOffline for offline backtracing.Yabin Cui2015-09-161-0/+189
It is used by simpeleprf for stack unwinding. Bug: 22229391 Change-Id: I26d698610ccdc9545da837bc5a8a9ec787f27a6b