summaryrefslogtreecommitdiff
path: root/libunwindstack/include/unwindstack/JitDebug.h
AgeCommit message (Collapse)Author
2021-03-22Share code between JitDebug and DexFilesDavid Srbecky
JitDebug and DexFiles use the same linked-list interface, the only difference is in the type of file they contain. Create base class to share the common code. Test: libunwindstack_unit_test Test: art/test.py -r -b --host -t 137 Change-Id: Ibc200250e6c6c36dd2f930c368dde5caf6a03268
2021-03-17Simplify JitDebug implementation with templates.David Srbecky
Reduce the amount of repeated code using templates. Test: libunwindstack_unit_test Change-Id: I92ab53b050bcb877974dff95496a1fc41cbb41c0
2021-03-09Add helpers to create JitDebug and DexFiles.David Srbecky
These helpers will make it easier to replace the implementation without affecting users of the classes. The helpers take the arch, which ensures it is set and it allows to return templated variant based on the arch. Test: art/test.py -r -b --host -t 137-cfi Test: libunwindstack_test Change-Id: I6e09ce29e39faa57c95fc8a3e86f2260bf91a76e
2021-03-09Rename JitDebug::GetElf and DexFiles::GetDexFileDavid Srbecky
Trivial rename separated from future CL. The two interfaces are almost identical. Bring the API closer so we can share code. Test: libunwindstack_test Change-Id: I5263b3d2a50ee0b32a07968f426c1513b4c540bf
2019-04-05Revert "Check for data races when reading JIT/DEX entries."David Srbecky
This reverts commit 91dc724d5ba73d60cc0f7c2b01e559e899ff3a87. 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-23Fix memory leak in UnwinderFromPid object.Christopher Ferris
Actually make the destructor virtual so that objects in UnwinderFromPid get freed. Also, explicitly make the DexFiles and JitDebug destructors virtual. Bug: 123099840 Test: Ran UnwindTest.local_from_pid thousands of times. Change-Id: I8bf11c0eb3587fa82f5f14f4723ea5c91da0fd46
2018-10-29Verify that the elf matches the expected arch.Christopher Ferris
To avoid a case where a malicious app might try and trick the system to create an elf and register object that mismatches, always verify that they are the same arch. Test: Ran unit tests. Change-Id: I66978e9e02f8e4f396856912e7019528ead4838e
2018-10-17Fix which maps to search for globals.Christopher Ferris
If multiple threads are unwinding at the same time, new maps that contain the global variables for dex files and jit information are created. This leads to threads creating more new maps that then get searched, then more maps, then more searching until virtual address space exhaustion. Fix this so that we only search maps that have a corresponding rw map that could contain the global memory. Small refactor to combine the code to search for global variables into one class that both classes inherit from. Modify unit tests for the new pattern checking. Bug: 117761427 Test: Ran unit tests for libunwindstack/libbacktrace/simpleperf. Test: Ran art 004-ThreadStress that used to fail. Change-Id: I837ca6b9d0383100079de090bc7d019598e0cdfe
2018-01-12Add ability to read jit gdb data.Christopher Ferris
Changes: - New JitDebug class to handle all of the jit gdb interface. - Add unit tests for all, along with new offline test using debug data. - Add new Memory type called MemoryOfflineParts that has multiple MemoryOffline objects to support the offline test. - Update the tools to use the JitDebug object. - Modify libbacktrace to use the JitDebug, but only looking in libart.so and libartd.so. - Change the Format32Bits to Is32Bit since it's more accurate and I use it in a different context where original name didn't make sense. - Add a new function to find global variables in an elf file (GetGlobalVariable). - Add a new function to determine if a pc is valid for this elf (IsValidPc). Bug: 68396769 Test: Ran new unit tests. Added new offline test that uses jit debug data. Test: Ran art test that generates jit data and verified a crash unwinds Test: through the jit data. Change-Id: I6e7ee2f5bab2242028a06feece156dff21c0a974