summaryrefslogtreecommitdiff
path: root/libunwindstack/tests/DwarfDebugFrameTest.cpp
AgeCommit message (Collapse)Author
2020-10-16Remove libprocinfo, libbacktrace, libunwindstackBaligh Uddin
These projects have moved to a different location. platform/system/core [libprocinfo] -> platform/system/libprocinfo platform/system/core [libbacktrace] -> platform/system/unwinding [libbacktrace] platform/system/core [libunwindstack] -> platform/system/unwinding [libunwindstack] BUG: 163786882 Test: Local build + TH Change-Id: Id6d278d917236df0ffd40b5c32593856e112cb5b
2020-02-22Rewrite DwarfSectionImpl::InsertFdeDavid Srbecky
Simplify and fix the algorithm. For consecutive functions (eg [10,20] [20,30]) without padding in between, the old algorithm would drop FDEs. Test: libunwindstack_test Change-Id: Ie886922bec262fb64d4b2ecf01c2961d0652dcdb
2019-12-11Add a name for all test suitesHaibo Huang
(for the new googletest Test: run tests Change-Id: I3856a4a8f3ed23bcfcc59bec7624595e91740be0
2019-06-20Switch case to suite to follow new gtest naming.Christopher Ferris
Bug: 135528735 Test: All unit tests pass. Change-Id: I1f3dc6fe381ec557b6b7bc5cb1c58d210efa63da
2019-04-01Add minimal support for Dwarf 5.Christopher Ferris
This is not full support for dwarf 5, this merely treats a Dwarf 5 version as Dwarf 4. There are new dwarf ops that are not supported yet, but this minimally support should allow unwinding to work if those ops are not present. Bug: 127355724 Test: New Unit tests pass. Change-Id: I35b24fbcb15a64acd49e1e0b6890dff4456ee6fd
2018-06-27Refactor the DwarfSection classes.Christopher Ferris
Modify the code for the no header sections because it turns out that it is not okay to assume that the fdes are non-overlapping. It's necessary to read the fdes in order and match as you go. Modify the code so that it only reads until it finds the given pc rather than reading all of the cie/fde entries at once. Rewrote the tests to verify the new behavior. Bug: 68998033 Bug: 110235461 Test: Ran libbacktrace/libunwindstack unit tests. Test: Unwind the mediaserver process on a walleye and verify it Test: unwinds properly. Change-Id: I7bb59d1db72c13fa34caa9735ec34c1a60e20ed2
2018-06-11Fix handling of load bias values.Christopher Ferris
It turns out that for the dwarf information, if a FDE indicates it's pc relative, then pc has to be incremented by the load bias. If not, then it should not be incremented. Previously, the code always subtracted load bias values from pcs, and assumed that all fdes were incremented by load bias values. The new code actually reads the fdes and adjusted the pcs in the fde and in the eh frame hdr so that load bias values are already handled properly. In addition, add dumping of arm exidx values in unwind_reg_info. This allowed verifying that the debug frame in those elf files was being handled properly. Added a new unit test that only has a debug frame that has a non-zero load bias and has fde entries that do not have pc relative encoding. Fix a couple of other small bugs. Bug: 109824792 Test: All libbacktrace/libunwindstack unit tests pass. Test: Ran ART 137-cfi test and 004-ThreadStress. Test: Verify that displaying the fde start and end pc actually match the Test: real data for fde that have pc relative set, and that don't. Test: Verified that the unwind information for arm exidx matches the Test: debug frame data. Change-Id: I707555286b5cb05df9f25489e8c5ede753cfe0fb
2018-01-24Add error propagation into Unwinder/Elf objects.Christopher Ferris
The backtrace offline code uses these error codes to diagnose errors. In addtion, I've had cases where seeing these errors would help diagnose failures. This also allows us to add a few features to indicate why an unwind terminated (such as max frames exceeded). Bug: 65682279 Test: Updated unit tests pass. Change-Id: If82b5092698e8a194016d670efff1320f9b44d50
2018-01-24Small behavioral changes to the unwinder.Christopher Ferris
- Be a little more lenient when reading the cies/fdes. If next entry data winds up incorrect, don't fail, simply stop processing the entries. This only applies when reading all of the cies/fdes at once. - Fail to init an eh_frame with no entries and fallback to assuming the eh_frame has no header instead. - Change the step to always try debug_frame first which has the most accurate information. - Add small unit tests and a couple of offline unit tests to verify this behavior. These changes are needed to support offline unwinding since it depends on this new behavior. Bug: 65682279 Test: Ran new unit tests. Change-Id: I3529f1b0c8e14cd7409494e5de2f3c9e78d0855e
2017-11-07Add support for only a .eh_frame.Christopher Ferris
Static executables only have a .eh_frame section and no .eh_frame_hdr section. Add support for this by rearranging the class hierarchy and creating a DwarfEhFrameWithHdr class and a DwarfEhFrame class to handle the different cases. Add new unit tests for DwarfEhFrame and for the new functionality. Bug: 68820189 Test: Passes new unit tests, unwinds static executables. Change-Id: I63d7cb8c52a686e96579a2266e18c0d06bbb6e63
2017-10-04Update the Unwinder object and add tests.Christopher Ferris
Changes: - Remove unused GetReturnAddressFromDefault function and tests. - Modify the unwinder to stop when a pc/sp in a device map. - Modify the unwinder to skip initial frames based on map names. - Unit tests that exercise all of the paths in the unwinder code. - Move the test Elf/ElfInterface objects into their own file. - Update RegsFake to handle extra cases. - Modify libbacktrace code to use this unwinder. The new unwinder does not implement the ignore frame functionality since this is not used very often and is better implemented using a skip frames in named libraries functionality. Test: Ran new unit tests, ran backtrace tests. Change-Id: Ifd65e9acd66ac5e2d0e04bd32a9ad870b54610ff
2017-07-14Make the library usable as a library.Christopher Ferris
- Add namespace unwindstack everywhere so that it's easier for other code to use the library. - Move some of the header files into include/unwindstack so that they can be exposed. - Modify the headers so that only a limited number need to be exposed. - Update the tools to use the new headers. - Add a GetLoadBias() call on the Elf object. This prevents the need to get the interface object out of the Elf object. - Move the GetRelPc() call out of the Reg class, to the Elf class. It's not always the case that a Reg object will be around when you want to get a relative pc. The tests for this moved to ElfTest.cpp. Bug: 23762183 Test: Unit tests pass. Change-Id: Iac609dac1dd90ed83d1a1e24ff2579c96c023bc3
2017-06-16Add EH frame and debug frame support.Christopher Ferris
Bug: 23762183 Test: Pass new unit tests. Change-Id: I1bfe900e068017ff31998f359bf98d4c5c9af2a5