| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 typos
* Cleanup trailing whitespaces in committed files
* Update include/tdep-ia64/libunwind_i.h
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
This reverts commit a9d50ef5066e8ff959dee5df5f997cc72c528f26.
|
| |
|
|
|
|
| |
Fix #341
|
| |
|
|
|
|
|
|
| |
This reverts commit e07b43c02d5cf1ea060c018fdf2e2ad34b7c7d80.
See pull #344
|
|
|
|
| |
when it is logically appropriate.
|
|
|
|
|
| |
This converts the invalid arithmetic negation on an unsigned value
to use the identity of bitwise negation plus one.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
| |
and fix the compiling type error for `extern atomic_bool tdep_init_done`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
This commit adds support for Linux on RISC-V. Only 64-bit is supported
at the moment.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
| |
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
Previously the PC value was being set to the LR instead, causing many
tests to fail.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
According to GLIBC headers those are in fact double (8 Byte) not
long double (16 Byte)
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Make an additional Linuxism dependent on building for Linux.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|