aboutsummaryrefslogtreecommitdiff
path: root/absl/debugging/internal
Commit message (Collapse)AuthorAgeFilesLines
* `demangle`: Parse template template and C++20 lambda template param ↵Dino Radakovic2024-02-152-2/+48
| | | | | | | | | substitutions These were described in https://github.com/itanium-cxx-abi/cxx-abi/pull/85 and implemented by LLVM. PiperOrigin-RevId: 607555558 Change-Id: I9991ac88c1fcf63b25b93d93977a83ca343cdb5d
* `demangle`: Parse optional single template argument for built-in typesDino Radakovic2024-02-132-6/+45
| | | | | | | The optional single template argument for built-in types is not documented in LLVM's comments that list the grammar, but it is [intentionally implemented](https://github.com/llvm/llvm-project/commit/4bc4d51c18d5c087dfbdad1753c84bba8dbf3be0). PiperOrigin-RevId: 606843797 Change-Id: Ib5ef1983812e9ea68a39fe64b87b6ad6ce81b93c
* `demangle`: Add complexity guard to `ParseQRequiresExpr`Dino Radakovic2024-02-131-0/+2
| | | | | | | | This function copies the parser's state onto the stack in order to perform backtracking. Adding a complexity guard will ensure that it fails gracefully, instead of contributing to excessive consumption of stack space. PiperOrigin-RevId: 606720511 Change-Id: I2f6f03e5f8bc4cc571a4159ecfc2af6f3e00fa68
* `demangle`: Parse `requires` clauses on template params, before function ↵Dino Radakovic2024-02-092-17/+59
| | | | | | | | | | | | | | | | return type For example, this covers the following: ``` template <typename T> requires std::integral<T> int foo(); ``` Refactor parsing of `Q <requires-clause expr>` into a single function that performs backtracking to avoid reimplementing `ParseTemplateArgs` in terms of nested if-else blocks. PiperOrigin-RevId: 605785418 Change-Id: I118998a75e050dcf46af125b613b690312fd3cbe
* `demangle`: Parse `requires` clauses on functionsDino Radakovic2024-02-092-8/+53
| | | | | | | These clauses show up in other places that end up mangled as parts of function signatures (e.g. on template struct params). We'll handle those in a follow-up. PiperOrigin-RevId: 605694497 Change-Id: I1bfe4c0cfaa739fdd24548b1547482410c92b5a7
* `demangle`: Parse C++20-compatible template param declarations, except those ↵Dino Radakovic2024-02-082-7/+97
| | | | | | | | | with `requires` expressions Support for `requires` expressions will be added in a follow-up. PiperOrigin-RevId: 605418370 Change-Id: I2c84cdf0c4599e36683b3c94dcbb173ab4fc3ee8
* `demangle`: Implement parsing for simplest constrained template argumentsDino Radakovic2024-02-072-0/+42
| | | | | | | | | | | | | | | | | C++20 introduced constraints, where concepts such as `std::integral` can be used to restrict template parameters: ``` template <std::integral T> int foo(T t); // Only accepts integral types. ``` Clang mangles these starting with a prefix `Tk`, followed by the concept name, which mangles as a type. For example, compare `foo` and `bar` here: https://godbolt.org/z/Kzbrrchde Note that this implementation doesn't cover the more complex case where the concept is templated too. See [llvm's implementation](https://github.com/llvm/llvm-project/commit/4b163e343cfa54c8d55c9da73c70d58f55ea9df2) and its tests for a thorough version. PiperOrigin-RevId: 604976260 Change-Id: Ic116c5f6f27c3f7714638bdee8de11dce871f0be
* Always check if the new frame pointer is readable.Abseil Team2024-01-231-7/+8
| | | | | | | Terminate the stack trace if it isn't. PiperOrigin-RevId: 600839499 Change-Id: I5692fa6cb52c4c8061b4ac14d8fba70f7fbabc52
* Avoid a empty library build failure on Apple platformsDerek Mauro2024-01-031-0/+18
| | | | | | | | | | | | | | | | | | | | | https://github.com/abseil/abseil-cpp/issues/1465 reports that some CMake builds on Apply platforms issue ``` warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: libabsl_bad_any_cast_impl.a the table of contents is empty (no object file members in the library define global symbols) ``` Our CMake build handles this problem for header-only libraries by not building a library at all. For some libraries, for example our polyfills, the library is only conditionally empty. In these libraries, I added a single char variable on Apple platforms as a workaround. I have been able to reproduce the warnings reported in https://github.com/abseil/abseil-cpp/issues/1465, but they don't fail the build for me. I don't see them any more after this change. PiperOrigin-RevId: 595480705 Change-Id: Ie48637e84ebae2f2aea4e2de83b146f30f6a76b9
* AddressIsReadable: improve commentsFangrui Song2023-12-201-2/+4
| | | | | | | | | | | | | | | | | | | Linux kernel's rt_sigprocmask correctly handles an unaligned user address[1]. The original issue was for qemu-user, which seems long irrelevant. Tested locally on an AArch64 CPU and qemu-aarch64-static. The alignment operation actually serves another purpose: when addr resides in the last 7 bytes of a page (unaligned), check only the current page and not the next. Update the comment. [1]: kernel/signal.c `SYSCALL_DEFINE4(rt_sigprocmask` arch/arm64/include/asm/uaccess.h:raw_copy_from_user arch/arm64/lib/copy_template.S "alignment handled by the hardware" PiperOrigin-RevId: 592618320 Change-Id: Ifbd05aba42f46e36e710cca940570213036b3ce0
* Add explicit int -> uintptr_t conversion in stacktrace code for aarch64Abseil Team2023-11-081-1/+1
| | | | | PiperOrigin-RevId: 580515441 Change-Id: I64999b11f1d83d56ed3680cb2d41c8a1d5f389de
* Properly handle signal stacks and frame-size calculationsAbseil Team2023-11-071-17/+38
| | | | | | | | | | | | | We can determine the signal stack, so use that information to make better decisions about when to calculate the frame size and when not to. This fixes a several tests where the memory layout had the signal stack and main stack in position that confused some of the greater-than/less-than comparisons. Also cleanup certain types to avoid more casting than necessary. PiperOrigin-RevId: 580221819 Change-Id: I0365b03e7893741603dc66e6d36a069d0b7f5404
* With sufficiently high-levels of optimization, this functionAbseil Team2023-10-041-0/+3
| | | | | | | | | and those that call it can be inlined sufficiently far to mess up high-level skip-counts. But this function assumes it is the bottommost frame, as in the comment below. PiperOrigin-RevId: 570790048 Change-Id: I4d354f9e79e13aaa6a8a62a9e0870fbeac075de6
* Re-submit with a fix for platforms without RTTI.Abseil Team2023-10-023-33/+81
| | | | | | | We test for `ABSL_INTERNAL_HAS_RTTI` in `absl::container_internal::TypeName` before calling `typeid`. PiperOrigin-RevId: 570101013 Change-Id: I1f2f9b2f475a6beae50d0b88718b17b296311155
* Delete dead function.Abseil Team2023-09-271-10/+0
| | | | | PiperOrigin-RevId: 568858834 Change-Id: I276efa86259aa425c4b6dff27f037f488a58c9ae
* Add an internal wrapper for `abi::__cxa_demangle()`.Abseil Team2023-09-263-81/+33
| | | | | PiperOrigin-RevId: 568665135 Change-Id: I42ec9bc6cfe923777f7b60ea032c7b64428493c9
* Add an internal wrapper for `abi::__cxa_demangle()`.Abseil Team2023-09-263-33/+81
| | | | | PiperOrigin-RevId: 568652465 Change-Id: I9f72a11cb514eaf694dae589a19dc139891e7af2
* PR #1500: Define MAP_ANONYMOUS if not definedRyan Schmidt2023-08-012-2/+8
| | | | | | | | | | | | Included are additional automated edits by clang-format on import. Merge d74896699faacc4a1667603e52e72cbdc8006cf6 into 22091f4c0d6626b3ef40446ce3d4ccab19425ca3 Merging this change closes #1500 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1500 from ryandesign:MAP_ANONYMOUS d74896699faacc4a1667603e52e72cbdc8006cf6 PiperOrigin-RevId: 552922776 Change-Id: I96a0395cb5e7156d7c7a889491c5d0b4cf755819
* Support Qualcomm Hexagon DSP targets.Abseil Team2023-06-291-1/+1
| | | | | PiperOrigin-RevId: 544438364 Change-Id: I22d461f2d0aa8638a0e640eebecdc7e5e2b49ea3
* Add missing #include <limits>Derek Mauro2023-06-201-0/+1
| | | | | | | Fixes #1482 PiperOrigin-RevId: 542023050 Change-Id: Iba712083edc9a24732a71f51be22ea970115809c
* The current aarch64 large-stack frame error handling is unsophisticated,Abseil Team2023-06-151-8/+35
| | | | | | | | | | | which makes it give up in certain situations where the x86 handler works fine This change adopts x86's more sophisticated stack-bounds-checking method for aarch64, and enables the HugeStack test to pass on aarch64. PiperOrigin-RevId: 540655431 Change-Id: If7d816330327722bbe5c135abfa77fda5e7e452b
* Fix unwinding through nested signal frames on aarch64.Abseil Team2023-06-091-4/+9
| | | | | | | | | | | | | | | This fixes an endless loop in the absl Arm stack unwinder where encountering a second signal return trampoline (as one has in nested signal frames), would restart unwinding at the outermost signal, resulting in an endless loop. This does not change any behavior in the non-nested signal case, so I believe it is safe for any stack that hasn't encountered this bug already. I would love to test this beyond the absl unwinding test cases and the fingerprint_test included here, but I'm at a loss for other test cases. PiperOrigin-RevId: 539113007 Change-Id: I10037f9fa77b45cc4db61f89b9c6380ec3529113
* Add VxWorks supportBin Lan2023-06-081-1/+2
|
* Merge pull request #1455 from juergbi:solarisCopybara-Service2023-05-231-1/+1
|\ | | | | | | | | PiperOrigin-RevId: 534619764 Change-Id: Ied99569176766f9708d5504eac9c7024cdcfd64b
| * absl/debugging: Fix build on SolarisJürg Billeter2023-05-231-1/+1
| |
* | Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.Andy Getzendanner2023-05-232-4/+4
|/ | | | | | | | | | | The non-RAW_ versions provide better output but weren't available when most of these tests were written. There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks. Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK. PiperOrigin-RevId: 534584435 Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
* Fix spelling mistakesVertexwahn2023-04-273-3/+3
|
* Fix some spelling mistakesVertexwahn2023-04-241-1/+1
|
* Properly calculate frame sizes on Aarch64Abseil Team2023-03-301-12/+15
| | | | | | | | For function N in the stack, the current code reports the size of frame N - 1. Fix that. PiperOrigin-RevId: 520688072 Change-Id: I984729f72f79aebae1b6997cb51d3ddef9199d1e
* Prefer C++ notation over CRose2023-02-161-1/+1
| | | | nullptr instead of 0 and nothing instead of void for function arguments is preferred.
* The type of MINSIGSTKSZ is not guaranteed; avoid potential implicit sign ↵Abseil Team2023-01-281-1/+1
| | | | | | | | | conversion. On some glibcs, this is defined as a call to sysconf(), which returns a long. PiperOrigin-RevId: 505380003 Change-Id: I53207846d733d3a529630a6aff9bca425cf90a21
* absl: harden stack bounds checkAbseil Team2023-01-231-6/+14
| | | | | | | | Ensure that we know both real low and high stack bounds when relying on the stack bounds check. PiperOrigin-RevId: 504003431 Change-Id: I8f6e6b75f5edff233d3cf80285f81b53f9080a0f
* absl: add a stack unwinding testAbseil Team2023-01-201-2/+16
| | | | | | | | | | | | | | | END_PUBLIC absl: relax frame size check in x86 stack unwinding Currently the unwinder stops whenever it sees a frame >100000 bytes. There may be such legitimate frames, the default stack size is O(megabytes). Only do this check if we are not within the thread stack bounds. The thread stack is assumed to be readable, so the worst thing that can happen if the large stack frame is actually bogus is that we will add one/few wrong frames and stop. PiperOrigin-RevId: 503374764 Change-Id: Icabb55d6468b12a42bf026c37c98dbe84977e659
* Replace std::atomic_flag with std::atomic<bool> to avoid the C++20Derek Mauro2022-11-091-0/+1
| | | | | | | | | | | | | | | | | deprecation of ATOMIC_FLAG_INIT. Another option would have been to use macros to only initialize std::atomic_flag before C++20, but I decided to use one compilation path instead. The major difference between std::atomic_flag and std::atomic<bool> is that the former is guaranteed to be lock-free, but we already assume std::atomic<bool> is lock-free in many places. https://en.cppreference.com/w/cpp/atomic/atomic_flag PiperOrigin-RevId: 487397075 Change-Id: I3f1c539ec8b2ca58547282e69ed73e93243e8efe
* Fix "unsafe narrowing" warnings in absl, 12/12.Abseil Team2022-10-131-7/+9
| | | | | | | | | | | | | | | Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL enables these warnings and fixes the remaining known issues.) Bug: chromium:1292951 PiperOrigin-RevId: 480981210 Change-Id: I92d5023c6833e24d6aa29b10d433116329972f41
* Fix stacktrace header includesDerek Mauro2022-09-082-2/+2
| | | | | | | Fixes #1275 PiperOrigin-RevId: 472990940 Change-Id: I1251b01b09e6a9baac52ae4df443714432115e90
* Fix "unsafe narrowing" warnings in absl, 7/n.Abseil Team2022-08-297-27/+33
| | | | | | | | | | | | | | | Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .cc files in debugging/internal/.) Bug: chromium:1292951 PiperOrigin-RevId: 470812243 Change-Id: I5578030bb42ba73cb83d4df84f89e431ceac8992
* debugging: handle alternate signal stacks better on RISCVSaleem Abdulrasool2022-08-041-69/+9
| | | | | | | | | | | | | In the case that we are unwinding with context, if the retreived frame pointer matches the signal context, assume that the value is valid and do not perform confidence checks. In any other case, continue to perform some validation to avoid returning an incorrect frame pointer. Given that the VDSO path is currently untested, remove the code to simplify the logic in the frame walking. PiperOrigin-RevId: 465360612 Change-Id: Iac656012182a12814bafecf20225ba68b90b4db1
* Fix "unsafe narrowing" warnings in absl, 2/n.Abseil Team2022-08-012-30/+33
| | | | | | | | | | | | | | | Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .cc files in dirs a-h.) Bug: chromium:1292951 PiperOrigin-RevId: 464541951 Change-Id: If23b63ccea8e9b730159ff1c7288e9300a40b6bd
* debugging: honour `STRICT_UNWINDING` in RISCV pathSaleem Abdulrasool2022-07-291-20/+20
| | | | | | | | | | | | | The changes in d6f96eda14aca77748a439f05a567a46ce87e462 enabled handling cases where the stack may be non-contiguous or not fully symbolicated (e.g. in cases of alternate signal stacks). However, it did not properly honour the requests from the caller to perform a strict unwinding where such frames are terminated upon the discontinuity. This repairs that condition. Hoist the alignment check since that is safe to perform early. PiperOrigin-RevId: 464160529 Change-Id: Ic65645928ec60c2a3b4844f3abd4fed1b991edab
* Fix "unsafe narrowing" warnings in absl, 1/n.Abseil Team2022-07-281-4/+5
| | | | | | | | | | | | | | | Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .h and win32 .inc files.) Bug: chromium:1292951 PiperOrigin-RevId: 463835431 Change-Id: If8e5f7f651d5cd96035e23e4623bdb08a7fedabe
* Fix frame pointer alignment check.Abseil Team2022-07-261-2/+2
| | | | | | | The frame pointer sanity check in NextStackFrame() was more restrictive than it is necessary. The frame pointer is used to load the saved link-register and the address for the next stack frame. So it only needs to be 8-byte aligned. The aarch64 ABI does not specify an alignment requirement for the frame point. PiperOrigin-RevId: 463368519 Change-Id: I473e05181603288f14734fe29013900c7505e201
* debugging: add hooks for checking stack rangesSaleem Abdulrasool2022-07-141-4/+17
| | | | | | | Add a hook to permit checking whether an address is in bounds for the stack. PiperOrigin-RevId: 460997074 Change-Id: Ib3b4d0cf656e614aa083457abb079c40ef8db0ff
* Support [[gnu::abi_tag("xyz")]] demangling.Abseil Team2022-07-132-9/+59
| | | | | PiperOrigin-RevId: 460752575 Change-Id: I9629504b5c63dbfe367cd55e287a782cd8fa546c
* Revert commit f4988f5bd4176345aad2a525e24d5fd11b3c97eaSaleem Abdulrasool2022-07-061-15/+0
| | | | | | | | This seems to have caused some regressions by causing a flaky failure in some cases. Revert the change to enable investigation. PiperOrigin-RevId: 459331687 Change-Id: Iaa4e4bfcb3013a75a2cd72768d980ac5e450f70c
* debugging: account for differences in alternate signal stacksSaleem Abdulrasool2022-06-301-0/+15
| | | | | | | | | | | | | The alternate signal stack may be sufficiently beyond the esimated frame size (100k). If we run into the case that the frame is not in the correct direction assume that the frames may be non-contiguous due to an alternate signal stack layout. In such a case, if we find that there is an alternate stack configured, ignore the discontiuity (assuming that it is a removable point-wise discontinuity) and continue the stack unwinding. This permits us to capture stack traces in more cases. PiperOrigin-RevId: 458327775 Change-Id: Ia8b461847401492f72a23ba26601c72e0109402c
* absl: correct the stack trace path on RISCVSaleem Abdulrasool2022-06-081-14/+11
| | | | | | | | | | | | | | | | | | | When we would perform a stacktrace using the frame pointer walking, because we did the adjustment for the return address separately, we were misaligning the stack size and frame. Simplify the logic and correct the offset. The recovered frame pointer provides us with the return address of the current frame and the previous frame's frame pointer. Subsequently, we decide if we want to record this frame or not. The value in `next_frame_pointer` already points to the value from the previous stack frame (that is the next frame pointer to iterate). As such, the value computed by `ComputeStackFrameSize` is the value for the current frame. This was offset by one previously. Take the opportunity to clean up some of the local comments, fixing typos and splitting up the comments to reflect the lines that they are associated with. PiperOrigin-RevId: 453744059 Change-Id: If14813e0ac36f327f4b7594472f2222d05c478aa
* Fix detection of ABSL_HAVE_ELF_MEM_IMAGE on HaikuDerek Mauro2022-05-251-2/+3
| | | | | | | | Fixes #1181 ORIGINAL_AUTHOR=jerome.duval@gmail.com PiperOrigin-RevId: 451006334 Change-Id: Id61e5889fb55594d09e92e7bb98fdf8bfbc13cc4
* Export of internal Abseil changesAbseil Team2022-04-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 3d018c03a34bf273a4b24b3584ed77f0a6d21686 by Abseil Team <absl-team@google.com>: Fix a spelling typo (s/boundries/boundaries). PiperOrigin-RevId: 442041877 Change-Id: I608020697d37b85316bb9a0838e4b457659c926c -- 518b8119e51db24ce7fb0fd2fe537ec43825c3e6 by Dino Radakovic <dinor@google.com>: absl/types/internal/variant: Make include guard uppercase https://google.github.io/styleguide/cppguide.html#The__define_Guard PiperOrigin-RevId: 441911692 Change-Id: I9837dd07f20204d8253f20627b0917a34dc21825 -- b91696c38310a7cae8c1ea9e2d479495f5dc3f69 by Greg Falcon <gfalcon@google.com>: Add an internal-only API to wrap __builtin_prefetch() if available. This private API is intended for future use by the Abseil implementation. Like any internal-namespaced function, it may be changed or removed at any time. PiperOrigin-RevId: 441894616 Change-Id: Iaa48bd4680b373f4a0d5afab0cb35e2a1908595f -- 0f01e8b0551a662e02dff60840c54320f987315f by Derek Mauro <dmauro@google.com>: C++20: Use the standard `constinit` keyword for `ABSL_CONST_INIT` when available PiperOrigin-RevId: 441778874 Change-Id: I70c616469752ff23b326b1c615437599f42cc6aa GitOrigin-RevId: 3d018c03a34bf273a4b24b3584ed77f0a6d21686
* Export of internal Abseil changesAbseil Team2022-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- ef2bf829c333f378ecc12f3259e3187cdb75a3d5 by Abseil Team <absl-team@google.com>: debugging: fix the VDSO symbol name used for unwinding on RISC-V Linux The name listed in `man vdso` is incorrect. Instead, use the name from `linux-5.16/arch/riscv/kernel/vdso/rt_sigreturn.S` PiperOrigin-RevId: 439654174 Change-Id: Ib39d066f416681720068e806e828a2c76a14a532 -- 43dfad824afd36cfc3e5049b4fea71a2bccb066c by Benjamin Barenblat <bbaren@google.com>: Check printf format strings in str_format_convert_test Add ABSL_PRINTF_ATTRIBUTE to appropriate functions in strings/internal/str_format/convert_test. Correct TypedFormatConvertTest.Char, which was accidentally passing values of types larger than int to StrPrint. PiperOrigin-RevId: 439388148 Change-Id: I6cde4e8e0c6455064138192430f07f4c990be0bc -- f84b4ab2c3b070c8af0c82742ac7a8a4bf443bca by Derek Mauro <dmauro@google.com>: Use __builtin_memcmp in the absl::string_view implementation starting with MSVC 16.9, where it first appeared This enables more constexpr operations PiperOrigin-RevId: 439317316 Change-Id: Iaf1ce76b60901d4b2d5b96be5900c56572f57b15 GitOrigin-RevId: ef2bf829c333f378ecc12f3259e3187cdb75a3d5