summaryrefslogtreecommitdiff
path: root/libbacktrace
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup symlink for system/core/{libbacktrace, libunwindstack}Baligh Uddin2020-10-301-1/+0
| | | | | | BUG: 170465278 Test: TH Change-Id: Ib906c46141886e691f4fc908d7b2f5dbe5eeda08
* Remove libprocinfo, libbacktrace, libunwindstackBaligh Uddin2020-10-1650-5354/+1
| | | | | | | | | | | 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
* Add arch member into Unwinder object.Christopher Ferris2020-09-242-2/+19
| | | | | | | | | | | | | | | This simplifies some of the logic and removes the need to pass an Arch value to functions that should already know about the arch it is operating on. Includes fixes for debuggerd/libbacktrace. Added new unit tests to cover new cases. Test: All unit tests pass. Test: Faked unwinder failing to verify debuggerd error messages display Test: properly in backtrace and tombstone. Change-Id: I439fcae0695befcfb1cb4c0a786cc74949d33425
* Cleanup for #inclusivefixit.Christopher Ferris2020-07-281-1/+1
| | | | | | | Bug: 161896447 Test: NA Change-Id: I8bc5b4be29f91b1884017aa3b4f28d91d9cac419
* Make libbacktrace buildable for native_bridgeVictor Khimenko2020-06-181-0/+5
| | | | | | | | Bug: http://b/153609531 Test: m -j64 libbacktrace.native_bridge Change-Id: I2b8a881b4e952f3b68dbcaeb14f147a6d955b406
* Fix visibility rules now that Make supports visibility checksDan Willemsen2020-06-091-1/+4
| | | | | | | | | | | | | | Previously, Soong visibility rules did not affect Make modules. Now these checks have been implemented in: https://android-review.googlesource.com/c/platform/build/+/1324454 So this fixes the visibility rules to include modules that were previously using libbacktrace_no_dex. Bug: 158599308 Test: treehugger Change-Id: I8f242015ce72ad989e13d56ab085f2abe2f8ce92
* backtrace: Set min_sdk_versionJooyung Han2020-05-131-0/+1
| | | | | | | | | | | | Modules contributing mainline modules (APK/APEX) should set min_sdk_version as well as apex_available. For now setting min_sdk_version doesn't change build outputs. But build-time checks will be added soon. Bug: 152655956 Test: m Change-Id: I9ff06ca47c8bc2cc5632ffb3494e4fb8eb79d5a3
* Remove use of static libdexfile to avoid linking in ART internal code.Martin Stjernholm2020-03-191-14/+41
| | | | | | | | | | | | | | | | | | | | | | - Create a static library libunwindstack_no_dex without DEX support. - Use it in libdebuggerd_handler_fallback, whose only use is in the linker, which shouldn't need that support. - Use it in init_first_stage, which doesn't need DEX support either. - Also need a libbacktrace_no_dex since it's in the dependency chain from init_first_stage to libunwindstack_no_dex. Also restrict the *_no_dex libs and libdebuggerd_handler_fallback as much as possible to avoid inadvertent use of these reduced functionality libs. Test: m init_first_stage on Cuttlefish where BOARD_BUILD_SYSTEM_ROOT_IMAGE=false Test: m system_image com.android.runtime Test: Build & boot Test: atest linker-unit-tests libunwindstack_unit_test debuggerd_test Bug: 142944931 Bug: 151466650 Change-Id: Iaacb29bfe602f3ca12a00a712e2a64c45ff0118b
* Whole static link libasync_safe to libbacktrace.aJiyong Park2020-03-111-0/+3
| | | | | | | | | | | | | | | | | | | When libbacktrace.a is statically lined to somewhere, that library had to add libasync_safe.a to static_libs because libbacktrace.a has references to libasync_safe.a. But libbacktace depending on libasync_safe is an implementation detail of libbacktrace, and therefore its client shouldn't be affected by it. Fixing this by doing the whole static link to libasync_safe to libbacktrace.a so that the former is included in libbacktrace.a Exempt-From-Owner-Approval: cherry-pick rvc-dev Bug: 149569129 Test: m Merged-In: If7366a240bc945dda9944fe7c111e10d328165bb (cherry picked from commit 7c8e2b247d2411d76196dc8a56656d39fe40214e) Change-Id: If7366a240bc945dda9944fe7c111e10d328165bb
* Set apex_available propertyJiyong Park2020-03-091-0/+8
| | | | | | | | | | | | | | | | | | | | | The marked library(ies) were available to the APEXes via the hand-written whitelist in build/soong/apex/apex.go. Trying to remove the whitelist by adding apex_available property to the Android.bp of the libraries. In this change, following libs were made available to all apexes because their usage is quite common and there is no reason to restrict them to some APEXes. * libbase_headers * libcutils, libcutils_headers * libutils_headers, libsystem_headers * liblog_headers * libbacktrace, libbacktrace_headers * libcrypto_utils Bug: 150999716 Test: m Change-Id: If3d3652e6604ed4f6d7694fe7ac61ae496621026
* libbacktrace: Fix clang-tidy warningLuca Stefani2019-09-091-2/+2
| | | | | | * warning: overloaded 'operator{++,--}' returns a reference instead of a constant object type [cert-dcl21-cpp] Change-Id: I8a904622b30dc70d17483b87748c2ea541e50c46
* Move to the libc++ demangler.Christopher Ferris2019-07-183-6/+19
| | | | | | | | Bug: 136138882 Test: Unit tests pass. Test: Did a kill -3 on a zygote process to verify art demangles properly. Change-Id: Iaf4fab191e84871be906b39cc32dd7c97c5d385a
* Internalize subclasses of MemoryCasey Dahlin2019-06-118-590/+5
| | | | | | | | | | | | | There are many subclasses of the Memory class and the overwhelming majority of them don't need to be exposed externally. We move all of them to internal headers except MemoryOfflineBuffer, which moves to a separate header. This dramatically reduces the exposed API surface and makes the code more modular. Also, remove the Offline code from libbacktrace. It's not used any where. Test: Unit tests pass, clean tree still builds Change-Id: I55dacdf080daba0bfe65c1ad53a4b326bb482e83
* Enable native_bridge_support for libbacktrace_headersdimitry2019-05-161-0/+1
| | | | | | | | | | | | | | | | | | | Android build system added support for building translated binaries used on natively bridged targets (arm on x86 for example). However in order to avoid building unnecessary binaries and libraries for such architectures most modules do not support native bridge by default. All needed modules have to explicitly indicate if they may be used as part of translated binary build. This change enabled native bridge support for libbacktrace_headers a dependency of libutils greylisted library (available for apps targeting Android version < N). Bug: http://b/77159578 Test: make Change-Id: I531d3d60937c5f7a95daead29dfc5913bd663321
* Fix pc/function name for signal handler frame.Christopher Ferris2019-04-123-0/+8
| | | | | | | | | | | | | | | This refactors the step function slightly to split it up into distinct pieces since the code needs to handle a signal handler versus normal step slightly differently. Add a new error for an invalid elf. Modify libbacktrace code to handle new error code. Bug: 130302288 Test: libbacktrace/libunwindstack unit tests. Change-Id: I3fb9b00c02d2cf2cc5911541bba0346c6f39b8e6
* Revert "Check for data races when reading JIT/DEX entries."David Srbecky2019-04-053-0/+32
| | | | | | | | This reverts commit 85b5fecec920208ec43b42488f08d4c2e5aaeda2. Reason for revert: Breaks ART tests, reverting to investigate. Change-Id: I1bb905407e87cbd4f832646651133a9caf6fcfc8
* Check for data races when reading JIT/DEX entries.David Srbecky2019-03-293-32/+0
| | | | | | | | | | | 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
* [libbacktrace] Modernize code to use override keywordYi Kong2019-03-251-1/+1
| | | | | | | Generated by clang-tidy. Test: m checkbuild Change-Id: I4506a9624002250117148413ea6990749cc1a4da
* Fix copy / move behaviour of Maps object.Florian Mayer2019-03-051-1/+1
| | | | | | | | | | | | | | | | | Currently, moving or copying a Maps object leads to double free of MapInfo. Even moving a Maps object did not prevent this, as after a move the object only has to be in an "unspecified but valid state", which can be the original state for a vector of raw pointers (but not for a vector of unique_ptrs). Changing to unique_ptrs is the most failsafe way to make sure we never accidentally destruct MapInfo. Test: atest libuwindstack_test Failed LocalUnwinderTest#unwind_after_dlopen which also fails at master. Change-Id: Id1c9739b334da5c1ba532fd55366e115940a66d3
* procinfo: Read inode number from /proc/<pid>/mapsSandeep Patil2019-02-111-17/+17
| | | | | | | | | | | | Adjust all callbacks to include the inode number as well. Fixes: 123532375 Test: libprocinfo_test Test: libdmabufinfo_test Test: libmeminfo_test Change-Id: I71fd75d90d5ee44585011c5ae654a1dd7e185458 Signed-off-by: Sandeep Patil <sspatil@google.com>
* Fix offsets when shared lib split across maps.Christopher Ferris2018-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | The linker was modified so that a shared library has a read-only map, then a read-execute map to represent the whole shared library. When backtraces are created, then the offsets are set incorrectly for backtraces. For example, all backtraces wind up with an offset now, and a shared library loaded out of an apk shows the wrong offset. Changes: - Fix the FormatFrame function which was putting the offset before the map name. - Refactor the Maps and MapInfo classes to keep track of the previous map instead of all maps. This was the only map that was ever needed. - Modify the unwind_for_offline tool to capture both the read-only and read-execute map when using the read-only segment option. Bug: 120981155 Test: Updated unit tests pass. Test: Unwinds on device don't show the offsets everywhere any more. Change-Id: I75b3727221be9c20316dfdcd7a1c6d242d7ce948
* [libbacktrace] Fix sign-compare warningYi Kong2018-12-171-1/+1
| | | | | | | static_cast GetThreadId result to pid_t. Test: m checkbuild Change-Id: Id3f541c1cb6cad9471e0cedf2ca49ce0fc38df38
* Verify that the elf matches the expected arch.Christopher Ferris2018-10-293-1/+18
| | | | | | | | | 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
* Always init gnu_debugdata interface if it exists.Christopher Ferris2018-10-231-1/+1
| | | | | | | | Every real call always sets the value to true to init the gnu_debugdata interface, so remove this parameter. Test: Builds, unit tests pass. Change-Id: I07fb3adbbd5b65b51c0dc7608561e820a5095051
* Implement support for linker rosegment option.Christopher Ferris2018-10-031-4/+0
| | | | | | | | | | | | | | | | | | | 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
* Load libbacktrace_test.so explicitly.Christopher Ferris2018-10-036-260/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | This guarantees that the shared library is loaded separately. It allows this test to be run without depending on the shared library being somewhere in the system path since the library is now treated as a file to be dlopen'd. This also fixes some bugs in the deleted shared library test code. The previous test was passing when it was really failing. This new test no longer passes incorrectly. Specifically, the original testlib library only had a debug_frame on 32 bit host, which is not mapped into memory. Adding the exceptions option causes a full eh_frame to be generated. Due to the new dlopen code, also, switching to the new isolated test runner. Also, changing the memory leak checker to use mallinfo since the new unwinder allocates everything using the normal allocator. The use of the isolated runner causes the PSS checker to fail because processes come and go which changes the PSS distribution to the process doing the PSS check. Bug: 109876814 Test: All unit tests pass. Change-Id: I1b77a783979a8beaae0c0b12823267f363e07977
* Remove unused ART build dependenciesOrion Hodson2018-08-311-16/+0
| | | | | Test: m Change-Id: I58e7c6ecb74d565d109012cc23a38083a60f3c52
* bionic supplies PR_SET_VMA now.Elliott Hughes2018-08-221-6/+3
| | | | | | Bug: N/A Test: builds Change-Id: I8254711543cbf11bdf905ea441655ca1c1e82aac
* Revert^2 "Prepare to fail in RefBase destructor if count is untouched"Hans Boehm2018-08-081-0/+1
| | | | | | | | | | This reverts commit b9d0753d2ba88cc60947823e68bb3bed60268361. Reason for revert: Re-land with MacOS workaround. Test: Build (on Linux) and boot AOSP, with weak symbols enabled and disabled. Change-Id: I5150cd90367178f3b039761dca3bccc9c2987df1
* Revert "Prepare to fail in RefBase destructor if count is untouched"Hans Boehm2018-08-071-1/+0
| | | | | | | | This reverts commit 9d3146af22588e0c23e110be13a515f5347bf687. Reason for revert: It appears that weak symbols don't work as expected on MacOS, breaking the MacOS aapt build. Change-Id: Ica0955106485a7bf2e2c3f09ff7910e230eb4139
* Prepare to fail in RefBase destructor if count is untouchedHans Boehm2018-08-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move towards crashing if a normally configured RefBase object is destroyed without ever incrementing the reference count. We've been threatening to do this for a long time. The previously last known violation had been fixed. This also fixes stack trace printing from RefBase, which had previously been broken, and which we found necessary to track down further violations of this rule. Unfortunately, we found several more violations with the aid of that fix. After existing CLs are submitted, there are still some failures, but they are no longer numerous. Thus this CL doesn't actually crash in the event of a violation, but does log a verbose stack trace if it encounters one. Bugs have been filed against the remaining known RefBase client offenders. We plan to enable crashing on usage violations once those are fixed. The fix for the stack trace printing breakage unfortunately requires the use of weak symbols in order to avoid a circular build dependency. We expect to eventually replace this with execinfo.h functionality. Some random reformatting, driven by consistency with current formatting requirements. Add missing include to BacktraceMap.h. Bug: 79112958 Bug: 30292291 Test: Boot AOSP, Master Change-Id: I8151c54560c3b6f75ffc4c48229f0388a2066958
* [libutils] Modernize codebase by replacing NULL with nullptrYi Kong2018-07-161-4/+4
| | | | | | | | Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
* Move libbacktrace off cutils.Elliott Hughes2018-07-1111-91/+21
| | | | | | | | | | | There's still <cutils/atomic.h> in a test, but I don't understand why that isn't just std::atomic. Also add a shared tgkill wrapper to libbase. Bug: N/A Test: ran tests Change-Id: Idd4baa1e1670a84b3a8f35803cc5ffe5aae008a6
* Merge "Build adbd for recovery"Treehugger Robot2018-05-251-2/+5
|\
| * Build adbd for recoveryJiyong Park2018-05-241-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | adbd (and its dependencies) are marked as recovery_available:true so that recovery version of the binary is built separately from the one for system partition. This allows us to stop copying the system version to the recovery partition and also opens up the way to enable shared libraries in the recovery partition. Then we can also build adbd as a dynamic executable. Bug: 79146551 Test: m -j adbd.recovery Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
* | Change tests to use a temporary dir for files.Christopher Ferris2018-05-241-42/+45
|/ | | | | | | | | | | Avoid using hard-coded paths for generated files. This can cause problems if the tests are run in parallel. Also fix a potential race condition in the unwind_through_unreadable_elf_remote test. Test: Ran tests in parallel and normally. Change-Id: Ib42522de49499766a29bda5bfffe737b56715e3f
* Merge "Mark as recovery_available: true"Treehugger Robot2018-05-221-0/+1
|\
| * Mark as recovery_available: trueJiyong Park2018-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Libraries that are direct or indirect dependencies of modules installed to recovery partition (e.g. toybox) are marked as recovery_available: true. This allows a recovery variant of the lib is created when it is depended by other recovery or recovery_available modules. Bug: 67916654 Bug: 64960723 Test: m -j Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
* | libprocinfo: add functions reading process map file.Yabin Cui2018-05-143-27/+20
|/ | | | | | | | | | | | | | | | Add test and benchmark. Also switch libbacktrace, libunwindstack, libmemunreachable to use libprocinfo for map file reading. The benchmark shows using libprocinfo speeds up map file reading in libbacktrace and libunwindstack 18% - 36% on walleye. Bug: http://b/79118393 Test: run procinfo_test. Test: run libunwindstack_test. Test: run libbacktrace_test. Test: run memunreachable_test. Change-Id: Icf281c352f4103fc8d4ba6732c5c07b943330ca1
* Merge "Remove unnecessary references to libunwind."Christopher Ferris2018-05-031-6/+0
|\
| * Remove unnecessary references to libunwind.Christopher Ferris2018-05-031-6/+0
| | | | | | | | | | | | | | | | Bug: 79209464 Test: Builds. Change-Id: I79f7b0123bc802e3e12d218e888c30dedf5204dc
* | Tell the build system about APCT's requirements.Elliott Hughes2018-05-031-0/+3
|/ | | | | | Bug: N/A Test: N/A Change-Id: I8a67e1ce5acc4142387878ba0bb542da0861e700
* Add test_suites lines.Elliott Hughes2018-04-271-0/+1
| | | | | | Bug: N/A Test: builds Change-Id: Ic5e2b9206bcfcb53c774989013b5db6aab462e42
* Add a MemoryOfflineBuffer object.Christopher Ferris2018-04-032-7/+9
| | | | | | | | | | | | | Use this for offline stack data so that it's not necessary to copy any data around. Add unit tests for the new object. Bug: 77258731 Bug: 74354410 Test: Ran libunwindstack/libbacktrace unit tests. Change-Id: I9b0f25d9520c96e64aedef5f295423c60ddb3488
* Method to avoid skipping frames for local unwinds.Christopher Ferris2018-03-233-3/+48
| | | | | | | | | | | | | 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
* Support a map that represents gdb jit elf data.Yabin Cui2018-03-211-0/+4
| | | | | | | | | | | | | Changes: - Add a new flag to the libbacktrace and libunwindstack map data. - Modify the unwinder to handle this map to use the raw pc when stepping. - Add new unit tests for this case. Bug: http://b/73127105 Test: Run simpleperf to unwind through jit symfiles. Test: Run new unit tests. Test: Run 137-cfi test on host. Change-Id: I10bc0410680accc6d35fe51e9f1098911f667e01
* Modify the offline handling interface.Christopher Ferris2018-02-235-17/+39
| | | | | | | | | | | - 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-202-0/+9
| | | | | | | Bug: 73558129 Test: New unit tests pass. Change-Id: I3a6b17d2590aacb367ab3e3a51cc85be73ad64eb
* bpfmt.Elliott Hughes2018-02-161-7/+6
| | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* Fix darwin buildChristopher Tate2018-02-161-0/+3
| | | | | | | Darwin needs libbase too. Test: 'm' Change-Id: I9d50face92b7d5a4399dbcebd39d4062477b3a2c