summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Adjust backtrace2 signatureHEADv1.7.0-rc2masterGregory LEOCADIE2023-01-111-3/+3
|
* Fix bug + add testGregory LEOCADIE2023-01-111-3/+17
|
* Fix bugGregory LEOCADIE2023-01-111-1/+1
|
* Add unw_backtrace2 implementationGregory LEOCADIE2023-01-111-3/+30
|
* Remove the unused powerpc setcontext() dummiesAdrian Bunk2023-01-042-18/+0
|
* fix the way load offset is detected so it works with lld linkerDaniel Moody2022-12-283-9/+5
|
* Add fix for arm and aarch64Gregory LEOCADIE2022-12-282-0/+18
|
* Fix frame categorizationGregory LEOCADIE2022-12-281-0/+6
|
* Updated to determine PAGE_SIZE dynamically for loongarch64Shuo Wang2022-11-151-13/+8
| | | | | | apply e85b65ce fix to loongarch64 Signed-off-by: Shuo Wang <wangshuo_1994@foxmail.com>
* arm64: Add support for VG register in signal framesJames Clark2022-11-073-2/+97
| | | | | | | | | | | | | | | | Allow local and remote unwinding through signal frames when variable length SVE registers are pushed onto the stack. The vector length is saved by the kernel into the signal context, but it is not scaled in the same way that dwarf expects it to be. Therefore a conditional has been added to tdep_access_regs() that scales the value depending on whether it is going to be accessed through a register or through memory. Signed-off-by: James Clark <james.clark@arm.com> Change-Id: Ie16aa22b36127ba5aa81f20280b1df7e4ba6d49b
* arm64: Add VG (Vector Granule) pseudo registerJames Clark2022-11-074-3/+15
| | | | | | | | | | | | | | 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
* arm64: Refactor signal frame register locationsJames Clark2022-11-071-34/+34
| | | | | | | | | | | Remove the 0 magic number and use the existing macro DWARF_MEM_LOC that makes it more readable that signal frame locations are stored in memory. No functional changes. Signed-off-by: James Clark <james.clark@arm.com> Change-Id: I5b15b4111290dec8e678b8bbd8c9d62d6e52fda0
* [LoongArch64] Simplify loongarch64_local_resumeWANG Xuerui2022-11-071-24/+17
| | | | | | | | | Simplify the restoration sequence in case of tail calls, and use the long-supported "jr" alias instead of the fully spelled out jirl form for brevity. Suggested-by: qiaopengcheng <qiaopengcheng-hf@loongson.cn> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* [LoongArch64] Reflect the kernel ABI changes since the port went upstreamWANG Xuerui2022-11-073-10/+6
| | | | | | | | | | | | | | | | | | 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>
* [LoongArch64] Fix build with upstream kernel headersWANG Xuerui2022-11-072-64/+64
| | | | | | | | | | | | The libunwind LoongArch64 port was done using an early fork of Linux, with slightly different naming for the register definition symbols. The libunwind port went in before the kernel port got finalized and merged, and was never adjusted; so fixing the usage here before release. Practically no user would be affected since everyone on (development) upstream kernels would have migrated long ago. Fixes: c5f1d12c77de ("Add port for Linux on LoongArch") Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* fix more warningskasperk812022-10-214-5/+5
|
* Fix a few warningsAdeel2022-10-143-3/+4
|
* Fix freebsd arm64 buildAdeel2022-09-231-2/+2
|
* Account for lr in aarch64's uc_addrAdeel2022-09-051-1/+3
|
* Fix undefined behavior issues in aarch64Adeel2022-09-021-8/+17
|
* Fix `make distcheck` due to missing coredump headerStephen Webb2022-08-231-1/+3
| | | | | | | A recent change missed adding a new header to the dist list. `make distckeck` now runs successfully once again. Fixes #409
* Add support for unwinding from the Linux vsyscall regionkent-cheung-arm2022-08-131-0/+27
| | | This change fixes unwinding from the vsyscall region. Although vsyscall has been phased out, it is still possible to call into it at an address where libunwind is unable to step out of.
* Fix __SOFTFP__ case for arm getcontextAdeel2022-08-051-1/+1
|
* Fix typos (#397)Adeel Mujahid2022-08-0412-21/+21
| | | | | | | * Fix typos * Cleanup trailing whitespaces in committed files * Update include/tdep-ia64/libunwind_i.h
* Add support for arm fp registers unwindJan Vorlicek2022-07-265-4/+73
|
* Stop assuming .text and .eh_frame segmentStephen Webb2022-07-2611-248/+624
| | | | | | | | | | | | | | | | | | | | | | | The coredump remote was architected on the assumption that the .text and .eh_frame sections were mapped onto the same segment, and that that segment was always the first PT_LOAD segment in an ELF file. Well, that was never a valid assumption, and moderns releases of various toolchains have started splitting the PT_LOAD segments for security reasons. This change implements an M:N mapping of PT_LOAD segments in a coredump file to backing ELF files and calculates and adjusts offsets appropriately. Because the backing files get mapped in a lot of file I/O operations have been replaced with simple memory reads. Once a backing file is memory mapped is stays mapped until the address space is destroyed. The ucd_*.[ch] files contain only functions that should not be exposed through the public API so they;re not mangled using the UB naming schedule because I just bring myself to write code with undefined behaviour. Reformatted some of the changed files using `astyle --style=gnu` for internal consistency withing the file. Fixes #363
* Find segment containing .text by flag not orderStephen Webb2022-07-261-1/+1
| | | | | | | | | The existing code was identifying the segment containing the executable code (.text section) by assuming it was effectively the first loadable segment. Th has always worked up until recently but was an invalid assumption. The right thing to do is check the segment flags to see if the execute bit is set. This change does just that. Tested on Linux x86_64, no new regressions.
* Autodetect presence of elf_fpregset_tStephen Webb2022-07-153-0/+10
| | | | | | | Data of this type was added for the s390x port doesn't exists on all OSes. It needs to be autodetected and optioned out. Fixes #373
* Expose get_proc_info_in_range APIAdeel2022-07-084-0/+120
|
* Add remote unwinding support for macOS (#365)Adeel Mujahid2022-06-283-4/+83
| | | | | | | | * 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
* Add autodetection of procfs_status typeStephen Webb2022-06-243-39/+49
| | | | | | | | | | Instead of struct elf_prstatus or struct prstatus, QNX has a procfs_status typedef. Added autoconfigury to detect that and switched using a preprocessor macro to define the type used as a typedef of UCD_proc_status_t instead. Also changed some field name references where required. Signed-off-by: Stephen Webb <swebb@blackberry.com>
* added coredump support for s390x (#373)tkoecker2022-06-235-10/+64
| | | | | | | | | | This change adds s390x coredump support, it contains the following: It adds reading the NT_FPREGSET notes, as the floating point registers are needed for unwinding on s390x. The fpregset is added to the thread data structure. The getter for floating point registers was implemented (at least for s390x). A register mapping for the registers in NT_PRSTATUS was added, as the register indices of the enum in libunwind are different to those in prstatus.
* Correct build failureAndrew Kilroy2022-06-221-1/+1
| | | | | | | | | | | | | | | | | | | The following pull request, targeting aarch64, introduced a build failure: https://github.com/libunwind/libunwind/pull/360 (f67ef2867bc5e74cdadb3acb790c3fc6161b22e9) The failing build was with the msvc compiler. According to https://docs.microsoft.com/en-us/cpp/assembler/inline/inline-assembler?view=msvc-170 the compiler only supports inline asm on x86. Since the inline assembly is only for local unwinding, this patch fixes the build by only compiling the inline assembly if UNW_REMOTE_ONLY is not defined. This works because the msvc build has UNW_REMOTE_ONLY set in the CMakeLists.txt file.
* Revert "Address CA issue using existing libunwind macros and explicit casting"Dave Watson2022-05-242-4/+4
| | | | This reverts commit a9d50ef5066e8ff959dee5df5f997cc72c528f26.
* Use constant for array size in os-linuxAdeel Mujahid2022-05-221-4/+5
| | | | | | | | | | When cross-compiling for Linux on Windows using VC toolchain (in dotnet/runtime), we get the following error: > error C2057: expected constant expression This is because VC runtime does not support VLAs The fix is to use a C constant.
* Add dummy `write` method implementationJan Vorlicek2022-05-221-0/+7
|
* Define sysconf on win for cross-compileJan Vorlicek2022-05-221-0/+12
|
* avoid leaking registers across sigreturnJameson Nash2022-05-2213-11/+48
| | | | | Mostly just relevant for fp registers, which are frequently mostly just ignored otherwise.
* DWARF: avoid invalid memory access with invalid CFISaleem Abdulrasool2022-05-221-0/+9
| | | | | | In the case that the CFI is incorrect, the return address column entry may be incorrect and point outside of the range of the program. Add a cheap validation to prevent the errant memory access.
* Fix for FreeBSD aarch64mikael2022-05-222-0/+12
|
* Use #if defined where applicableAdeel2022-05-223-3/+3
|
* Add support for FreeBSD/PPC32Piotr Kubaj2022-05-224-81/+140
| | | | While here, mention that FreeBSD/PPC64 is also supported.
* Fix issues with 4701Aaron Robinson2022-05-223-6/+7
|
* 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 based on MSVC static analyzerAaron Robinson2022-05-221-2/+2
|
* Unwind with pointer authentication on arm64Andrew Kilroy2022-05-223-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Updated to determine PAGE_SIZE dynamically.Daniel Moody2022-03-107-77/+61
|
* Fix to malloc call in tdep_get_elf_imageJonathan R. Madsen2022-03-101-3/+16
| | | | - causes deadlock in signal handler
* Update license in pal-single-threaded.cAdeel Mujahid2022-03-101-3/+20
|