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
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
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
- 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
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
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