summaryrefslogtreecommitdiff
path: root/absl/debugging
Commit message (Collapse)AuthorAge
* Avoid a empty library build failure on Apple platformsGravatar Derek Mauro2024-01-03
| | | | | | | | | | | | | | | | | | | | | 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 commentsGravatar Fangrui Song2023-12-20
| | | | | | | | | | | | | | | | | | | 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.Gravatar Abseil Team2023-11-15
| | | | | | | | | | | | | | | | | | | | 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 aarch64Gravatar Abseil Team2023-11-08
| | | | | PiperOrigin-RevId: 580515441 Change-Id: I64999b11f1d83d56ed3680cb2d41c8a1d5f389de
* Properly handle signal stacks and frame-size calculationsGravatar Abseil Team2023-11-07
| | | | | | | | | | | | | 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_headersGravatar Derek Mauro2023-10-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 functionGravatar Abseil Team2023-10-04
| | | | | | | | | 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.Gravatar Abseil Team2023-10-02
| | | | | | | We test for `ABSL_INTERNAL_HAS_RTTI` in `absl::container_internal::TypeName` before calling `typeid`. PiperOrigin-RevId: 570101013 Change-Id: I1f2f9b2f475a6beae50d0b88718b17b296311155
* Delete dead function.Gravatar Abseil Team2023-09-27
| | | | | PiperOrigin-RevId: 568858834 Change-Id: I276efa86259aa425c4b6dff27f037f488a58c9ae
* Add an internal wrapper for `abi::__cxa_demangle()`.Gravatar Abseil Team2023-09-26
| | | | | PiperOrigin-RevId: 568665135 Change-Id: I42ec9bc6cfe923777f7b60ea032c7b64428493c9
* Add an internal wrapper for `abi::__cxa_demangle()`.Gravatar Abseil Team2023-09-26
| | | | | PiperOrigin-RevId: 568652465 Change-Id: I9f72a11cb514eaf694dae589a19dc139891e7af2
* PR #1509: Allow building when targeting WASIGravatar Anuraag Agrawal2023-08-15
| | | | | | | | | | | | | 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 definedGravatar Ryan Schmidt2023-08-01
| | | | | | | | | | | | 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.Gravatar Tom Rybka2023-07-06
| | | | | | | | | | | | | | | | | | | | | | 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 v1Gravatar Benjamin Barenblat2023-06-29
| | | | | | | | | | 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.Gravatar Abseil Team2023-06-29
| | | | | PiperOrigin-RevId: 544438364 Change-Id: I22d461f2d0aa8638a0e640eebecdc7e5e2b49ea3
* Add missing #include <limits>Gravatar Derek Mauro2023-06-20
| | | | | | | Fixes #1482 PiperOrigin-RevId: 542023050 Change-Id: Iba712083edc9a24732a71f51be22ea970115809c
* The current aarch64 large-stack frame error handling is unsophisticated,Gravatar Abseil Team2023-06-15
| | | | | | | | | | | 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.Gravatar Abseil Team2023-06-15
| | | | | | | 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.Gravatar Abseil Team2023-06-09
| | | | | | | | | | | | | | | 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 supportGravatar Bin Lan2023-06-08
|
* Note that AsyncSignalSafeWriteToStderr preserves errno, and inline one use ↵Gravatar Andy Getzendanner2023-05-25
| | | | | | | of it into a lambda. PiperOrigin-RevId: 535245982 Change-Id: I816f60c8b6476536df6836500f01c9a3ad88ddd4
* Merge pull request #1455 from juergbi:solarisGravatar Copybara-Service2023-05-23
|\ | | | | | | | | PiperOrigin-RevId: 534619764 Change-Id: Ied99569176766f9708d5504eac9c7024cdcfd64b
* | Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.Gravatar Andy Getzendanner2023-05-23
| | | | | | | | | | | | | | | | | | | | | | 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
| * absl/debugging: Fix build on SolarisGravatar Jürg Billeter2023-05-23
|/
* Add missing dependency on dynamic_annotations to stacktrace, which is needed ↵Gravatar Abseil Team2023-05-08
| | | | | | | | | in some of the builds. PiperOrigin-RevId: 530308301 Change-Id: I7c885156e14d9c8c444c7c6f8d38e7aaac7c01a7
* Fix spelling mistakesGravatar Vertexwahn2023-04-27
|
* Fix some spelling mistakesGravatar Vertexwahn2023-04-24
|
* Name anonymous memory allocations on Linux.Gravatar Abseil Team2023-04-12
| | | | | | | | | | | | | | | | | | | 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 Aarch64Gravatar Abseil Team2023-03-30
| | | | | | | | 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 MingwGravatar Abseil Team2023-02-28
| | | | | PiperOrigin-RevId: 512974770 Change-Id: If7a8128996d2a73ac566faaa676ddd3858d51af6
* Merge pull request #1393 from AtariDreams:cppGravatar Copybara-Service2023-02-22
|\ | | | | | | | | PiperOrigin-RevId: 511696041 Change-Id: I77a87c8721f64e0d9e9a70e08a7127312488ff21
* \ Merge pull request #1394 from AtariDreams:constructorsGravatar Copybara-Service2023-02-21
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 511271203 Change-Id: I1ed352e06265b705b62d401a50b4699d01f7f1d7
* | | absl: fix potential int overflow in ELF readingGravatar Abseil Team2023-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Convert empty constructors to default onesGravatar Rose2023-02-17
|/ / | | | | | | These make the changed constructors match closer to the other ones that are default.
| * Prefer C++ notation over CGravatar Rose2023-02-16
|/ | | | 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 ↵Gravatar Abseil Team2023-01-28
| | | | | | | | | 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 checkGravatar Abseil Team2023-01-23
| | | | | | | | 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 testGravatar Abseil Team2023-01-20
| | | | | | | | | | | | | | | 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.Gravatar Abseil Team2022-12-27
| | | | | PiperOrigin-RevId: 498048994 Change-Id: Iee969b9171921e3ffdca2610f9b93b53678d0b9d
* Replace std::atomic_flag with std::atomic<bool> to avoid the C++20Gravatar Derek Mauro2022-11-09
| | | | | | | | | | | | | | | | | 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
* Use the `-l` form for MinGW-specific link dependenciesGravatar Russell Johnston2022-10-15
| | | | | This corrects the generated .pc files, so these libs match the other libs already included there.
* Fix "unsafe narrowing" warnings in absl, 12/12.Gravatar Abseil Team2022-10-13
| | | | | | | | | | | | | | | 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
* Improve failure message: tell the values we don't like.Gravatar Abseil Team2022-09-13
| | | | | PiperOrigin-RevId: 474043469 Change-Id: I9ea33a8bf026263c9e10d2a183014a5ee8df1306
* Increase the number of per-ObjFile program headers we can expect.Gravatar Abseil Team2022-09-13
| | | | | PiperOrigin-RevId: 474017481 Change-Id: I1be222fa38ad01f6ddbcddd610f9629fd4888777
* Fix format string error with an explicit castGravatar Derek Mauro2022-09-08
| | | | | PiperOrigin-RevId: 473088472 Change-Id: If4fb8354490821cbaf53743f51bf0b0d2ba85895
* Fix "unsafe narrowing" warnings in absl, 9/n.Gravatar Abseil Team2022-09-08
| | | | | | | | | | | | | | | 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 miscellaneous non-test source files.) Bug: chromium:1292951 PiperOrigin-RevId: 473054605 Change-Id: Ifd7b24966613ca915511a3a607095508068200b8
* Fix stacktrace header includesGravatar Derek Mauro2022-09-08
| | | | | | | Fixes #1275 PiperOrigin-RevId: 472990940 Change-Id: I1251b01b09e6a9baac52ae4df443714432115e90
* Add a missing dependency on :raw_logging_internalGravatar Abseil Team2022-09-07
| | | | | | | | | | | | | internal/stacktrace_x86-inl.inc includes internal/raw_logging.h and therefore needs a direct dependency to satisfy Bazel layering_check (Clang -fmodules-strict-decluse). Clang before https://reviews.llvm.org/D132779 does not report the issue becasue: * internal/stacktrace_x86-inl.inc is an .inc file and is not checked as a main file * internal/stacktrace_x86-inl.inc is a textual header and older Clang incorrectly considers there is no requesting module and suppresses the error. PiperOrigin-RevId: 472795469 Change-Id: Ia4ad667ea80b2590cef1adfd22af025c8df826ac
* Fix "unsafe narrowing" warnings in absl, 7/n.Gravatar Abseil Team2022-08-29
| | | | | | | | | | | | | | | 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