summaryrefslogtreecommitdiff
path: root/libunwindstack/tests/DexFileTest.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-04-07Avoid re-mapping dex file that's in local memory.Sim Sun
If the Dex file we're trying to examine is already within the unwinder's address space, we don't need to load it from disk or copy it across processes. This avoids using up virtual address space to map in dex files, and also should be a bit faster to read since it won't go out to the file. Patch by Chris Sarbora Test: Ran new unit tests. Test: Ran 137-cfi art test. Change-Id: I949457856f051cca11b9020e9da3a41bbf6e5c8e
2020-03-20Fix memory leak of DexFile handle after releaseYong Li
The DexFile handle is allocated from heap in OpenFromFd/OpenFromMemory. After releasing the unique_ptr, the DexFile handle itself is no longer managed by the smart pointer. However, the DexFile handle is not freed in the constructor of DexFileFromFile/DexFileFromMemory. This change uses get() method to get the DexFile pointer while allowing it to be managed by smart pointer so that it can be freed after method end. Added new unit tests to detect leaks. Bug: 151966190 Test: Unwinding can still retrieve dex frame information during crash. Test: Ran new unit tests before change and verified they fail, ran them Test: after the change and verified they don't fail. Signed-off-by: Yong Li <yongl0722@gmail.com> Change-Id: I0627e1e255eb6644aba51e940c1a79ff78d568d7
2020-01-22Properly handle empty map after read-only map.Christopher Ferris
Recently, the maps for an elf in memory might show up looking like: f0000-f1000 0 r-- /system/lib/libc.so f1000-f2000 0 --- f2000-f3000 1000 r-x /system/lib/libc.so f3000-f4000 2000 rw- /system/lib/libc.so The problem is that there is logic in the code that assumed that the map before the execute map must be the read-only map. In the case above, this is not true. Add a new prev_real_map that will point to the previous map that is not one of these empty maps. This will fix the backtraces that look like this: #00 pc 0000000000050d58 /apex/com.android.runtime/lib64/bionic/libc.so!libc.so (offset 0x50000) (syscall+24) (BuildId: 5252408bf30e395d49ee270b54c77ca4) To get rid of the !libc.so and the offset value, which is not correct. Added new unit tests to verify this. Added new offline test which an empty map between read-only and execute map. Before this change, the backtraces had lines like libc.so!libc.so (offset XXX) would be present. Bug: 148075852 Test: Ran unit tests. Change-Id: Ie04bfc96b8f91ed885cb1e655cf1e346efe48a45
2019-04-05Revert "Check for data races when reading JIT/DEX entries."David Srbecky
This reverts commit 85b5fecec920208ec43b42488f08d4c2e5aaeda2. Reason for revert: Breaks ART tests, reverting to investigate. Change-Id: I1bb905407e87cbd4f832646651133a9caf6fcfc8
2019-03-29Check for data races when reading JIT/DEX entries.David Srbecky
Update the entries only when the list is modified by the runtime. Check that the list wasn't concurrently modified when being read. Bug: 124287208 Test: libunwindstack_test Test: art/test.py -b --host -r -t 137-cfi Change-Id: I87ba70322053a01b3d5be1fdf6310e1dc21bb084
2019-01-11Remove dependency on libdexfile internal header.Martin Stjernholm
Also remove some tests for implementation details in the libdexfile API that are now covered by unit tests there (http://r.android.com/867370). Test: mmma system/core/{libunwindstack,libbacktrace} and run host gtests Bug: 119632407 Change-Id: Ie731bb929a564de56ce1c78385da12a43d0954ff
2018-12-19Revert^2 "Use libdexfile external API in libunwindstack."Martin Stjernholm
This reverts commit cacf5bf6bca7e9806739a27589d8b6101c567c32. Reason for revert: Re-apply with proper fix for VNDK visibility on marlin and sailfish. Test: Manual repro of http://b/121110092#comment1 on reported branch Test: atest CtsRenderscriptTestCases Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Test: Forrest cts/art/gce-all: https://android-build.googleplex.com/builds/forrest/run/L00300000240828791 Test: Forrest cts/bionic/gce-all: https://android-build.googleplex.com/builds/forrest/run/L05600000240682947 (shows 27/2958 failed, but it doesn't pass on Blackbox either: http://screen/xbjioEf6UgR) Test: Forrest cts/renderscript/gce-all: https://android-build.googleplex.com/builds/forrest/run/L66200000240680523 Bug: 119632407 Change-Id: I601aa97eac8127e30d753405f8bc1fc4ae7f849f
2018-12-19Revert "Use libdexfile external API in libunwindstack."Martin Stjernholm
This reverts commit 444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b. The rest of the topic doesn't need to be reverted. Reason for revert: Breaks renderscript on marlin and sailfish. Test: Manual repro of http://b/121110092#comment1 on reported branch Test: "atest CtsRenderscriptTestCases" on that branch Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Bug: 121110092, 119632407 Change-Id: If1976b19ce386c95bc5bd4fd6d523745c167de18
2018-12-13Use libdexfile external API in libunwindstack.Martin Stjernholm
Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Bug: 119632407 Change-Id: I370f089a1b20ba432e136818b4325d46f99df708
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
2018-10-03Implement support for linker rosegment option.Christopher Ferris
The rosegment linker option results in two maps containing the elf data existing. One is an execute map where the code lives, and the other is the read-only segment which contains the elf header information. If the file backing a shared library in memory is not readable, then the new code will attempt to find the read-only map that has the same name as the current execute segment, and that is at offest zero in the file. Add new unit tests for this functionality. Add the missing MapInfoCreateMemoryTest.cpp to the list of tests. Bug: 109657296 Test: Pass new unit tests. Test: All unit libbacktrace/libunwindstack tests pass with rosegment enabled. Change-Id: If8f69e4a067d77b3f2a7c31e2e5cd989a0702a8c
2018-07-20Create lookup table of DEX symbols.David Srbecky
Create fast lookup table instead of iterating every single time. This will create the cache as methods are searched for. Test: 137-cfi Change-Id: I4be190bb1a637fef5d385b993be6a7e2203a6814
2018-02-07Remove dependency on -no_art variantDavid Sehr
Remove an external dependency on a shim I used to protect against renaming. Bug: 22322814 Test: make -j 50 Change-Id: I7e6eaee7d82a1a42d4c37daa74803cefc7bb68ce
2018-02-02Load dex files from ART-specific data structure.Christopher Ferris
Fixes cdex which was recently changed to have shared data section, which means the DEX PC cannot be used to find the right symbol, as the bytecode is no longer within the dex file, and in-fact, we might have to scan multiple dex files to find the method. Bug: 72520014 Test: testrunner.py --host --cdex-none -t 137 Test: testrunner.py --host --cdex-fast -t 137 Test: All unit tests pass. Change-Id: I80265d05ad69dd9cefbe3f8a75e4cd349002af5e
2018-01-31Move dex pc frame creation into libunwindstack.Christopher Ferris
Test: Compiles, all unit tests pass. Test: Ran 137-cfi art test in interpreter and verified interpreter Test: frames still show up. Change-Id: Icea90194986faa733a873e8cf467fc2513eb5573