summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Adjust backtrace2 signatureHEADv1.7.0-rc2masterGregory LEOCADIE2023-01-111-1/+1
|
* Add unw_backtrace2 implementationGregory LEOCADIE2023-01-111-0/+1
|
* arm64: Add VG (Vector Granule) pseudo registerJames Clark2022-11-071-0/+3
| | | | | | | | | | | | | | This allows remote only unwinding though an SVE function that pushes SVE registers onto the stack[1]. The remote unwinder is responsible for providing the value of the VG register at the time the sample was taken. [1]: https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst Signed-off-by: James Clark <james.clark@arm.com> Change-Id: I8a203b73b17cd4a07afc1fdc55ad11765d73e173
* [LoongArch64] Reflect the kernel ABI changes since the port went upstreamWANG Xuerui2022-11-071-1/+1
| | | | | | | | | | | | | | | | | | The original port was done with an early in-house port of Linux that, in addition to slightly different UAPI headers, also featured a MIPS-like ABI (the so-called "old world" ABI). The upstream ABI has been revised since long ago and already frozen, so adjust the port for the "new world". In particular, we don't have the 24-byte signal trampoline area any more which was a MIPS o32 thing. We don't need to keep compatibility for the old-world kernels, because distributions using said kernels invariably packaged their own libunwind fork with corresponding support, and the few users tracking upstream kernels should all have moved on. Fixes: c5f1d12c77de ("Add port for Linux on LoongArch") Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* fix more warningskasperk812022-10-211-1/+1
|
* Fix a few warningsAdeel2022-10-141-1/+1
|
* Fix __SOFTFP__ case for arm getcontextAdeel2022-08-051-17/+24
|
* Add RISC-V machine value in remote unwindAdeel2022-08-051-0/+1
|
* Fix typos (#397)Adeel Mujahid2022-08-043-3/+3
| | | | | | | * Fix typos * Cleanup trailing whitespaces in committed files * Update include/tdep-ia64/libunwind_i.h
* Add support for arm fp registers unwindJan Vorlicek2022-07-261-28/+30
|
* Expose get_proc_info_in_range APIAdeel2022-07-081-27/+34
|
* Add remote unwinding support for macOS (#365)Adeel Mujahid2022-06-2817-17/+57
| | | | | | | | * Add remote unwinding support for macOS * Fix broken Win build by bumping minimum language requirement to C11 * Update license headers * Rename remote_unwind to remote * Revert Gparser.c
* Revert "Address CA issue using existing libunwind macros and explicit casting"Dave Watson2022-05-242-4/+4
| | | | This reverts commit a9d50ef5066e8ff959dee5df5f997cc72c528f26.
* Define sysconf on win for cross-compileJan Vorlicek2022-05-221-0/+3
|
* fix incorrect store in AArch64 getcontextJameson Nash2022-05-221-1/+1
| | | | Fix #341
* Fix for FreeBSD aarch64mikael2022-05-221-1/+10
|
* Revert "FreeBSD also uses these structs so do not hide them"Dave Watson2022-05-221-1/+1
| | | | | | This reverts commit e07b43c02d5cf1ea060c018fdf2e2ad34b7c7d80. See pull #344
* Address CA issue using existing libunwind macros and explicit castingAaron Robinson2022-05-222-4/+4
| | | | when it is logically appropriate.
* Remove 4146 from libunwindAaron Robinson2022-05-222-4/+4
| | | | | This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.
* Update mempool.hAaron Robinson2022-05-221-1/+1
|
* Update based on MSVC static analyzerAaron Robinson2022-05-221-1/+1
|
* Define and use `UNW_EMPTY_STRUCT` also for x86Mosè Giordano2022-05-221-2/+6
|
* Make some structs non-emptyMosè Giordano2022-05-223-10/+4
| | | | | | | | | | | | | | | | GCC shows warnings like this when compiling libraries or programs linking to libunwind: ``` /buildworker/worker/package_linuxaarch64/build/usr/include/libunwind-aarch64.h:60:9: warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] typedef struct ^~~~~~ /buildworker/worker/package_linuxaarch64/build/usr/include/libunwind-aarch64.h:169:16: warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] typedef struct unw_tdep_save_loc ^~~~~~~~~~~~~~~~~ ``` The pattern of using a dummy field is already used in other platforms.
* Unwind with pointer authentication on arm64Andrew Kilroy2022-05-222-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the ability for libunwind to unwind a stack where the return address obtained from the arm64 link register (x30) has a pointer authentication code (PAC). Without this patch, the unw_step function terminates early, leaving the user the impression there is only a leaf frame when there are more. The reason for the premature termination is that an aarch64 specific CFI opcode 'DW_CFA_AARCH64_negate_ra_state' is not recognised, and treated as unexpected. Upon the next iteration's call of unw_step, it reports the end of the stack. For an expected callstack of loop // most recent call call3 call2 call1 main // oldest call The caller of libunwind observes: unw_step() = 1 unw_get_reg(UNW_REG_IP) = 0, pc = 0xaaaae4720798 unw_step() = 1 unw_get_reg(UNW_REG_IP) = 0, pc = 0x5faaaae47207cc // ip with PAC unw_step() = 0 // premature end For remote unwinding, this patch adds an optional callback function 'ptrauth_insn_mask' on unw_accessors_t so that unw_step can correctly strip off the PAC to leave the correct return address. This also has the benefit that an attempt to get the name of the function with unw_get_proc_name can succeed. The callback is given the original unw_addr_space_t and as_arg as given to unw_init_remote. The application needs to ensure the mask to be returned is somehow available on the as_arg and callback should return it. The callback is only needed for remote unwinding. In local unwinding, an instruction is used to strip the PAC. A description of pointer authentication is in the armv8 reference manual available here: https://developer.arm.com/documentation/ddi0487/ha/?lang=en (Version H.a, section D5.1.5 Pointer authentication in AArch64 state, page D5-4772) Also documentation for the use of DWARF with pointer authentication, in particular the RA_SIGN_STATE: https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst
* FreeBSD also uses these structs so do not hide themBrad Davis2022-03-101-1/+1
|
* Updated to determine PAGE_SIZE dynamically.Daniel Moody2022-03-101-0/+9
|
* [Loongarch64] amend the LoongArch64's CMakeLists.txtqiaopengcheng2022-03-101-1/+1
| | | | and fix the compiling type error for `extern atomic_bool tdep_init_done`.
* Add more POSIX polyfills for nix cross-build on winAdeel2021-11-302-0/+36
|
* Add port for Linux on LoongArchYouling Tang2021-11-308-0/+490
| | | | | | | | | | | | | | This commit adds support for Linux on LoongArch. Only 64-bit is supported at the moment. The changes were tested on a LoongArch architecture Loongson-3A5000 processor (LoongArch is a new RISC ISA, which is a bit like MIPS or RISC-V.). Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Signed-off-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* Expose function-pointer-to-name APIBjörn Svensson2021-11-261-0/+3
| | | | | | The unw_get_proc_name_by_ip() function returns the name of a procedure just like unw_get_proc_name(), except that it's looked up by an instruction-pointer instead of a cursor.
* Update libunwind-dynamic.hiarspider2021-11-261-1/+1
|
* Update libunwind-common.h.iniarspider2021-11-261-1/+1
|
* Update libunwind-aarch64.hiarspider2021-11-261-1/+1
|
* Prefer EXTBL unwinding on ARMYichao Yu2021-11-261-0/+4
| | | | | | | It is part of the C++ ABI so a EXTBL unwind info that's not `CANT_UNWIND` should always be reliable/correct. Ignore `ESTOPUNWIND` so that a `CANT_UNWIND` info can fallback to unwinding using the debug info instead.
* x86_64: Stop aliasing RSP and CFAKeno Fischer2021-11-264-49/+33
| | | | | | | | | | | | | | | | | | | | | | RSP and CFA are different concepts. RSP refers to the physical register, CFA is a virtual register that serves as the base address for various other saved registers. It is true that in many frames these are set to alias, however this is not a requirement. For example, a function that performs a stack switch would likely change the rsp in the middle of the function, but would keep the CFA at the original RSP such that saved registers may be appropriately recovered. We are seeing incorrect unwinds in the Julia runtime when running julia under rr. This is because injects code (with correct CFI) that performs just such a stack switch [1]. GDB manages to unwind this correctly, but libunwind incorrectly sets the rsp to the CFA address, causing a misunwind. Tested on x86_64, patches for other architectures are ported, but not tested. [1] https://github.com/rr-debugger/rr/blob/469c22059a4a1798d33a8a224457faf22b2c178c/src/preload/syscall_hook.S#L454
* Add port for Linux on RISC-V (riscv)Zhaofeng Li2021-07-068-0/+597
| | | | | This commit adds support for Linux on RISC-V. Only 64-bit is supported at the moment.
* Fix `unw_tdep_context_t` for AArch64 Androidxtkoba2021-04-191-0/+8
|
* Fixes for the s390x targetUlrich Weigand2021-03-152-7/+9
| | | | | | | | | | | | | | | | - Fix unwinding GPRs that were saved in FPRs Since DWARF_FPREG_LOC locations satisfy *both* DWARF_IS_REG_LOC and DWARF_IS_FP_LOC, code that has to distinguish between the two must check DWARF_IS_FP_LOC *first*. This fixes a failure in test-ptrace on Ubuntu 20.04. - Fix build using (older versions of) clang Use fully-qualified register names (%r15) in inline asm. Those work with all existing compilers. - Add missing s390x include in include/tdep/dwarf-config.h - Add s390x files to CMakeLists.txt to enable cmake build
* Port memory address checks from x86/x86_64 to Aarch64Mikhail Durnev2021-03-151-2/+12
| | | | Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
* [x86_64] Remove self-reference from local cursorElia Geretto2021-03-151-4/+34
| | | | | | | | | | | | | | | | | When creating a local x86_64 cursor, its `dwarf.as_arg` member is set to point to the cursor itself, making it a self-referential struct. This does not allow to safely keep a copy of a cursor, as stated in the documentation. In addition, the self-reference is used to access just two members: `uc` and `validate`. This commit modifies `dwarf.as_arg` to pack together both `uc` and `validate`, so the x86_64 cursor is not self-referential anymore and no additional memory allocation is performed. Since `uc` points to a `ucontext_t`, which is at least 2-byte aligned, it is safe to store the `validate` bit in the LSB of the `uc` pointer. Additional checks were added to verify that the `validate` bit is not set when the cursor is non-local.
* Fix Clang buildsFlorian Fainelli2021-02-171-0/+1
| | | | | | | | | | | While cross-compiling strace against libunwind for ARM, the configure script of strace failed with: libunwind-ptrace.h:40:27: error: a parameter list without types is only allowed in a function definition it turns out that we do not have a definition for what pid_t should be, so include sys/types.h to remedy that.
* stop lying about the ARM PC locationJameson Nash2021-02-171-1/+1
| | | | | | I am not sure why it should lie about the PC register and use a different random value (LR), when the actual value is also easily available. The rate of passing tests seems to be the same.
* improve unw_getcontext on ARM/ThumbJameson Nash2021-02-171-19/+33
| | | | | | | | | | | | Better support unw_resume, by returning r0 from the user, instead of hard-coding it to zero (also incidentally fixing a compiler warning about an unused expression). This better mimics a real function call, instead of hard-coding the return value. When in thumb mode, this also means we also need to avoid switching between thumb and ARM upon return to this point, so we need to set the pc accurately to point after the return instruction. When in ARM mode, we need an extra nop also to point at the correct return instruction (since the stored value of pc in the context runs ahead by 8 bytes, while stmia is only 4 bytes).
* fix aarch64 getcontext functionalityJameson Nash2020-12-171-6/+9
| | | | | Previously the PC value was being set to the LR instead, causing many tests to fail.
* Add support for older versions of AndroidOle André Vadla Ravnås2020-12-032-0/+4
| | | | | | | Based on: - dl_iterate_phdr() patch by Jeff Muizelaar. - maps_next() improvement from AOSP: 7d46a21. - unwi_unwind_method and x86_local_resume() from AOSP: 1c82a52.
* Define the FP register size on PPC to be doubleAlexander Grund2020-10-201-1/+1
| | | | | According to GLIBC headers those are in fact double (8 Byte) not long double (16 Byte)
* Fix unwinding of pre-linked librariesMikhail Durnev2020-09-212-0/+3
| | | | | | | | | | | Prelinker updates section .eh_frame but does not change section .debug_frame. Libunwind can work with prelinked .eh_frame, but if fails to find call frame info in unmodified .debug_frame because it does not add the load offset. ELF load offset from PT_LOAD p_vaddr has to be used to correctly interpret addresses in the .debug_frame section. Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
* Fix problems found in aarch64 buildStephen Webb2020-06-181-1/+5
| | | | Make an additional Linuxism dependent on building for Linux.
* Handle <elf.h> that uses enums instead of definesStephen Webb2020-06-181-0/+10
| | | | | | | | | | Handle the case in which the system-supplied elf.h file uses C enums instead of macros preprocessor defines for some constants. Made the inclusion of the discovered elf.h file more consistent for portability to non-Linux targets. Put some libunwind-specific ELF macros into the UNW_ namespace.
* Rationalize endianness macrosStephen Webb2020-06-183-25/+55
| | | | | | | | | Extend the endianness macros to support systems that define them in <sys/param.h> and replace the use of names that violate ISO/IEC 9899. Rename endianness macros used in code to use properly-namespaced macros for portability and cross-hosting compatibility. Add inline functions to perform common operations with the macros.