summaryrefslogtreecommitdiffstats
path: root/libbacktrace/include
Commit message (Collapse)AuthorAgeFilesLines
* Method to avoid skipping frames for local unwinds.Christopher Ferris2018-03-271-0/+6
| | | | | | | | | | | | | | In cases where there might be a crash in the unwind library itself, we need a method to avoid skipping these frames or we won't be able to see the actual crash. Added unit test for this behavior. Bug: 74121887 Test: Ran unit tests on host and target. Change-Id: I45825020c174016af39dd8ffdc67acb72a24ad4d (cherry picked from commit 458f4e725d65e0d400552fbdbefb7d4b19d3c3c5)
* Modify the offline handling interface.Christopher Ferris2018-02-232-2/+6
| | | | | | | | | | | - Add a new function Backtrace::UnwindOffline that takes the stack data. - Modify BacktraceMap::CreateOffline so it doesn't take the stack data. This makes it easier to reuse the map object created this way. Reusing the map object increases simpleperf speed (unwinds per second) by 50%. Test: backtrace_test libunwindstack_test Change-Id: I90cfbae9e50d95d8a0e3cd394b33ba36d65d45f7
* Add ability to skip function name resolution.Christopher Ferris2018-02-201-0/+8
| | | | | | | Bug: 73558129 Test: New unit tests pass. Change-Id: I3a6b17d2590aacb367ab3e3a51cc85be73ad64eb
* Include the map name when dumping memory around a register.Elliott Hughes2018-02-151-0/+3
| | | | | | Bug: http://b/19590178 Test: ran tests, ran crasher Change-Id: Ib9afa34c860d8732ef1943eb4decd0b7c8fb55fd
* Use new unwinder for offline in libbacktrace.Christopher Ferris2018-01-292-13/+32
| | | | | | | | | | | | | 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
* Add extra frame when dex_pc is non-zero.Christopher Ferris2018-01-231-1/+0
| | | | | | | | | | | | | | | Use the art dex file library to read the dex data. Add unit tests for the UnwindDexFile code. Bug: 72070049 Test: All unit tests continue to pass. Test: Dumped the backtrace of the 137-cfi test while running in interpreter Test: mode and verified that the stack trace is correct. Did this on host Test: and for arm/arm64. Change-Id: Ia6f343318c5dd6968a954015a7d59fdf101575b0
* Merge "Change all uintptr_t to uint64_t in API."Christopher Ferris2018-01-192-24/+25
|\
| * Change all uintptr_t to uint64_t in API.Christopher Ferris2018-01-182-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add support for getting a dex pc.Christopher Ferris2018-01-171-0/+1
|/ | | | | | | | | | | | | | | | | | | | Changes: - Change the register type from int16_t to uint32_t for the location data and the Eval processing. This is because the special dex pc is > 65535. - Add the ability for Dwarf register location information to point to a register that is itself a Dwarf location register. - Add dex_pc to the frame information. - Modify the unwind tool to print the dex pc if non-zero. This does not implement the printing of the dex information in anything but the unwind tool. It's not the final form of this printing. Bug: 72070049 Test: Ran new unit tests. Test: Dumped stack while in interpreter running 137-cfi art test and Test: verified dex pc is set to non-zero. Change-Id: I6ce8a6b577fb4f92abacbd433b1f68977e272542
* libBacktraceOffline: improve unwinding callchains.Yabin Cui2017-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+24
| | | | | | | | This is to help debugging different offline unwiding failures. Bug: http://b/69383534 Test: run backtrace_test. Change-Id: I5ed4837027a9f17d032925e97e9f5927161444b3
* Demand read load bias for a map.Christopher Ferris2017-12-051-8/+46
| | | | | | | | | | | | | | | | | | | 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
* Only skip frames for local unwinds.Christopher Ferris2017-11-021-1/+2
| | | | | | | | | | | | | | | When doing a remote unwind, and there is a crash in the unwind stack code or in libbacktrace, the old version would skip those frames. This makes debugging crashes in those libraries a bit difficult. Bug: 68820611 Test: Ran unit tests. Test: kill -3 a zygote process and verify no frames in Test: libunwindstack.so/libbacktrace.so. Test: Forced a crash in libunwindstack.so and verified the tombstone Test: contains the full crash. Change-Id: I297e5b3775c87c0dddf57ebb423bd72ba1baf193
* Switch libbacktrace new unwinder.Christopher Ferris2017-10-302-4/+0
| | | | | | | | | | | | | Update the backtrace leak tests to share a map since this is the most common way it will be used, and it runs much faster. Remove the CreateNew functions, and references to them. Remove benchmarks of CreateNew functions. Test: Builds, ran new unit tests, ran art tests. Change-Id: I4a25a412f1a74c6d43aebbebbf32ead20ead8f94
* Add an interface for stopping in certain maps.Christopher Ferris2017-10-241-2/+9
| | | | | | | | | Also, change the std::set parameters to std::vector. As jmgao points out, a small std::set is not really the best choice for performance reasons. Test: All unit tests pass, enabled the new unwinder and did a kill -3 on Test: an android process. Change-Id: I81227d7b79a9b7cf1d54fb0e3331d3cf4d4d3c4f
* libbacktrace: expose BacktraceMap's unwindstack::Memory.Josh Gao2017-10-201-0/+5
| | | | | Test: mma Change-Id: Icd2b891b121b90d55e3ac45037a59c24221a2496
* libunwindstack: expose UnwindStackMap::GetFunctionName.Josh Gao2017-10-201-0/+3
| | | | | Test: mma Change-Id: I8736ff5c2ed7c5e64eb68df5f4eccfed614612c7
* libbacktrace: expose libunwindstack Unwind routine.Josh Gao2017-10-201-0/+7
| | | | | Test: backtrace_test32/64 on hikey960 Change-Id: Iae6e342a8ffd13b4d5f76b39dd434c827f7a4d9e
* Show the number of VMAs in the tombstone.Elliott Hughes2017-09-261-0/+2
| | | | | | | | | | Tombstones (especially ones with lots of VMAs) are regularly truncated. We can at least show the number of VMAs, though, for anyone interested in knowing whether they got close to the default 64Ki limit. Bug: http://b/66911122 Test: ran crasher, examined tombstone Change-Id: I286db66f28f132307d573dbe5164efc969dc6ddc
* libbacktrace: make Backtrace::FormatFrameData static.Josh Gao2017-09-061-1/+1
| | | | | | | | | Backtrace::FormatFrameData doesn't depend on anything from its instance. Make it static so that callers that don't have a Backtrace* available can format frames. Test: mma Change-Id: Id0ca93bbef19da488305374e58b25c7ca9d0e518
* Add support for the new unwind method.Christopher Ferris2017-08-032-0/+4
| | | | | | | | | | | | | | | Also add a comment to the GetElf function to indicate that it never returns nullptr. Also needed to add this library to the a million and one places that the vndk has hard-coded this data. Bug: 23762183 Test: Built, nothing uses the new code. Test: However, I did run backtrace_test using this code, and all tests pass. Change-Id: Ib270665dcb7a7607075e36d88be76dbde6e2faa8 (cherry picked from commit dc4104b720c7fd2014ccfa9fa621d02df58a43c4)
* Merge "Revert "Add support for the new unwind method.""Christopher Ferris2017-08-022-4/+0
|\
| * Revert "Add support for the new unwind method."Christopher Ferris2017-08-022-4/+0
| | | | | | | | | | | | | | | | This reverts commit 5b460d13a4c383fa6c9a416d64502430ab065209. Reason for revert: Strange sailfish boot problem. Change-Id: Ibde9375405cca4343c262335647dac120aab4d73
* | Merge "Add support for the new unwind method."Christopher Ferris2017-08-012-0/+4
|\|
| * Add support for the new unwind method.Christopher Ferris2017-07-312-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Also add a comment to the GetElf function to indicate that it never returns nullptr. Bug: 23762183 Test: Built, nothing uses the new code. Test: However, I did run backtrace_test using this code, and all tests pass. Change-Id: I252b9c2497e2d3d94347dd6e506170bf50cbfe16
* | Fix misc-macro-parentheses warnings in system/core.Chih-Hung Hsieh2017-08-011-2/+2
|/ | | | | | | | | | | | Add NOLINT comment to work around clang-tidy error in checking macro arguments used in type expressions. Bug: 28705665 Test: make with WITH_TIDY=1 WITH_TIDY_CHECKS=-*,misc-macro-* \ WITH_TIDY_FLAGS=-header-filter=system/core/.* Change-Id: I7619978c1804e151a11a8b0477e80076bcf21cab
* Cleanup the libbacktrace interface a bit.Christopher Ferris2017-07-192-9/+2
| | | | | | | | | | | | - 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
* Moved include/backtrace to libbacktrace/includeVijay Venkatraman2017-04-113-0/+335
Export libbacktrace_headers Bug: 33241851 Test: Build sailfish Change-Id: Iba310ffc21d17ba542bed954a960ab305037061c