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
This is to help debugging different offline unwiding failures.
Bug: http://b/69383534
Test: run backtrace_test.
Change-Id: I5ed4837027a9f17d032925e97e9f5927161444b3
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
Make libbacktraceoffline thread-safe by protecting the global variable with
a lock. So it can be used in a multi-thread environment, like by
simpleperf inplace sampling.
Bug: http://b/30974760
Test: no
Change-Id: I4699bf15dfa69ac75faeb4e79a73fb3af0f08dfc
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 was inheriting -Wno-unused-parameter from llvm's
makefiles. Fix an unused parameter warning when compiling for an
unsupported architecture, and return false since *value wasn't
written.
Test: lunch aosp_mips-eng && mma -j
Change-Id: I7df990f01e1025ca17ec3717107df56d2349f3cb
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
Bug: http://b/31320715
Test: No regression in 32-bit and 64-bit backtrace_test on host and
angler.
Change-Id: Ic5c5511e89ca7707ed9c13d5ba0539e09310dfe3
Remove the logging of an error if a thread disappears before the unwind
can begin. This can happen, so allow the caller to determine if this
is really a problem worth logging.
Bug: 27449879
Change-Id: Ie81718d53fb0e519fa0a7db9fd5f314b72bfa431
BacktraceOffline is the only code that uses libLLVM. Create
a new shared library, backtrace_offline.so, that references this
so that including libbacktrace.so doesn't wind up pulling in libLLVM.
Change-Id: I90c502d833f6c464c3810dffde52a0c6da241cce
This reverts commit ab5e583327.
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
Using llvm makes libbacktrace stops building for 32 bit on linux host x86_64.
This reverts commit c9c6b6ee77.
Change-Id: Ieb807db881d7bb3132cd09e25fd08c28766ca0a8