aboutsummaryrefslogtreecommitdiff
path: root/absl/debugging
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
* Fix a typo.Abseil Team2024-02-041-1/+1
| | | | | PiperOrigin-RevId: 604094890 Change-Id: If5634a15c7ea7c8ef2cc9b6d09636ee7836946d2
* 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
* Speed-up absl::Symbolize by ~6x via faster file reads.Abseil Team2023-11-151-44/+108
| | | | | | | | | | | | | | | | | | | | absl::Symbolize does tons of tiny reads. Speed this up by switching from lseek+read to a pread, and by reading more data than requested into a buffer. A faster absl::Symbolize will be helpful in tests and when printing stack traces on /threadz etc. Results for absl::Symbolize benchmark that exercises uncached behavior of absl::Symbolize: ``` name old time/op new time/op delta BM_Symbolize 16.4ms ±12% 2.6ms ± 0% -84.06% (p=0.001 n=5+9) ``` PiperOrigin-RevId: 582687566 Change-Id: I44caf189d81867f3fd8c050a3100a4b9a8e744d7
* 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
* Bazel: Support layering_check and parse_headersDerek Mauro2023-10-101-0/+10
| | | | | | | | | | | | | The layering_check feature ensures that rules that include a header explicitly depend on a rule that exports that header. Compiler support is required, and currently only Clang 16+ supports diagnoses layering_check failures. The parse_headers feature ensures headers are self-contained by compiling them with -fsyntax-only on supported compilers. PiperOrigin-RevId: 572350144 Change-Id: I37297f761566d686d9dd58d318979d688b7e36d1
* 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-024-34/+85
| | | | | | | 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-264-85/+34
| | | | | PiperOrigin-RevId: 568665135 Change-Id: I42ec9bc6cfe923777f7b60ea032c7b64428493c9
* Add an internal wrapper for `abi::__cxa_demangle()`.Abseil Team2023-09-264-34/+85
| | | | | PiperOrigin-RevId: 568652465 Change-Id: I9f72a11cb514eaf694dae589a19dc139891e7af2
* PR #1509: Allow building when targeting WASIAnuraag Agrawal2023-08-151-1/+1
| | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1509 WASI is similar to emscripten, providing a syscall layer to WebAssembly focused on server side applications. There are some config knobs that are in place to allow building the repo for emscripten which also need to support wasi (as built with LLVM). Aside from that, there are still some features it supports less than escripten, for example related to signals, causing the build to be even more limited for it. Merge ec9fa081609687035005dfdafd312754f31c3fbb into 861e53c8f075c8c4d67bd4c82217c57239fc97cf Merging this change closes #1509 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1509 from anuraaga:wasi-sdk-build ec9fa081609687035005dfdafd312754f31c3fbb PiperOrigin-RevId: 557166498 Change-Id: Ic51149d8b092fd888c9a5c383275257fc8ff4232
* PR #1500: Define MAP_ANONYMOUS if not definedRyan Schmidt2023-08-014-35/+34
| | | | | | | | | | | | 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
* symbolize_test: Add an indirection for getting the PC from function ptr.Tom Rybka2023-07-062-24/+58
| | | | | | | | | | | | | | | | | | | | | | Don't assume that function ptr == PC. Adds a redirection mechanism, GetPCFromFnPtr, and enables more test cases for Emscripten/Wasm. On many (most?) platforms, the address of a function ptr is the same as its Program Counter (PC) for the purpose of most things, including symbolization. In Emscripten WebAssembly, the function ptr is just an index into a table of functions. However, the name section maps function names to their literal offsets into a Wasm binary. The WasmOffsetConverter is actually capable of both indirections, so we can effectively go from function ptr to offset into the binary (which is typically the "PC" for other Stack dumping things in Wasm, including `emscripten_pc_get_function`). More info: https://www.w3.org/TR/wasm-js-api-2/#exported-function-exotic-objects Also fix Emscripten symbolize handling for `nullptr` now that we have tests for that. PiperOrigin-RevId: 546006678 Change-Id: I0d4015ca9035b004158451b36c933cad009184ba
* Fix symbolization on PowerPC ELF v1Benjamin Barenblat2023-06-291-19/+33
| | | | | | | | | | The big-endian PowerPC ELF ABI (ppc64 in Debian) relies on function descriptors mapped in a non-executable segment. Make sure that segment is scanned during symbolization. Also correct bounds computation for that segment. PiperOrigin-RevId: 544440302 Change-Id: Ic05532aa35ae9efa127028318640ee7cdeeecc5f
* 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-152-10/+37
| | | | | | | | | | | 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
* Rename AsyncSignalSafeWriteToStderr to AsyncSignalSafeWriteError.Abseil Team2023-06-151-2/+1
| | | | | | | It no longer strictly writes to stderr, since Emscripten/WebAssembly now use _emscripten_err which might be replaced by something that is not the same as stderr by the host. PiperOrigin-RevId: 540655336 Change-Id: Icc2a430a0db53a1282ef5558e9f3648db67e972c
* 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
|
* Note that AsyncSignalSafeWriteToStderr preserves errno, and inline one use ↵Andy Getzendanner2023-05-251-5/+5
| | | | | | | of it into a lambda. PiperOrigin-RevId: 535245982 Change-Id: I816f60c8b6476536df6836500f01c9a3ad88ddd4
* 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-238-42/+49
|/ | | | | | | | | | | 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
* Add missing dependency on dynamic_annotations to stacktrace, which is needed ↵Abseil Team2023-05-082-0/+2
| | | | | | | | | in some of the builds. PiperOrigin-RevId: 530308301 Change-Id: I7c885156e14d9c8c444c7c6f8d38e7aaac7c01a7
* Fix spelling mistakesVertexwahn2023-04-274-4/+4
|
* Fix some spelling mistakesVertexwahn2023-04-241-1/+1
|
* Name anonymous memory allocations on Linux.Abseil Team2023-04-121-0/+18
| | | | | | | | | | | | | | | | | | | Use Linux's prctl(PR_SET_VMA) system call to name memory arenas being allocated using mmap(MAP_ANONYMOUS). This change allows Abseil's memory arena(s) to be distinguished from other uses of anonymous memory within a process, which in turn helps investigations into the memory usage of applications. The change adds a new prctl() system call to the code paths that call mmap(). This is not expected to add significant overhead to applications. The call to prctl(PR_SET_VMA, ...) can fail if the Linux kernel in use was not configured with the CONFIG_ANON_VMA_NAME kernel option. This should be OK since the naming memory regions is primarily a debugging aid. PiperOrigin-RevId: 523687348 Change-Id: Ie404e5eeef0a6da53330b3a56149c4f3bc6bf5c7
* 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
* Fix //absl/{base,debugging:symbolize} build with MingwAbseil Team2023-02-281-0/+4
| | | | | PiperOrigin-RevId: 512974770 Change-Id: If7a8128996d2a73ac566faaa676ddd3858d51af6
* Merge pull request #1393 from AtariDreams:cppCopybara-Service2023-02-221-1/+1
|\ | | | | | | | | PiperOrigin-RevId: 511696041 Change-Id: I77a87c8721f64e0d9e9a70e08a7127312488ff21
| * Prefer C++ notation over CRose2023-02-161-1/+1
| | | | | | | | nullptr instead of 0 and nothing instead of void for function arguments is preferred.
* | Merge pull request #1394 from AtariDreams:constructorsCopybara-Service2023-02-211-2/+2
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 511271203 Change-Id: I1ed352e06265b705b62d401a50b4699d01f7f1d7
| * | Convert empty constructors to default onesRose2023-02-171-2/+2
| |/ | | | | | | These make the changed constructors match closer to the other ones that are default.
* / absl: fix potential int overflow in ELF readingAbseil Team2023-02-211-0/+10
|/ | | | | | | | | | | | | | Both e_shentsize and e_shstrndx are uint16, so the product elf_header.e_shentsize * elf_header.e_shstrndx can overflow the promoted type int (MAX_UINT16 * MAX_UINT16 > MAX_INT), which is undefined behavior. Not sure if it can affect any real cases or not, though. Cast e_shentsize to loff_t instead of e_shoff. This makes both multiplication and addition to use loff_t type. PiperOrigin-RevId: 511254775 Change-Id: I39c493bfb539cca6742aae807c50718d31e7c001
* 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-204-2/+88
| | | | | | | | | | | | | | | 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
* [NFC] fix typo in comment.Abseil Team2022-12-271-1/+1
| | | | | PiperOrigin-RevId: 498048994 Change-Id: Iee969b9171921e3ffdca2610f9b93b53678d0b9d
* 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