summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Consistently use POSIX <ucontext.h>Stephen Webb2020-06-181-1/+1
| | | | | Use the (former) POSIX-standard <ucontext.h> everywhere instead of sometimes using the Linux-specxific <sys/ucontext.h>.
* Fix typosSteve MacLean2020-06-183-3/+3
|
* Fix placement of alignas() specifierSteve MacLean2020-06-182-2/+2
| | | | | | | | | | | | The alignment specifier must appear before the typename i.e. clang9 refused to compile uint8_t alignas(MAX_ALIGN) __reserved[128]; but accepted alignas(MAX_ALIGN) uint8_t __reserved[128];
* Fix Windows abstraction SIZEOF_*Steve MacLean2020-06-042-1/+29
| | | | Use actual sizes from current kernels for the Windows abstraction layer
* Add Windows build supportSteve MacLean2020-06-041-0/+10
| | | | | Add CMake file for Windows build Enable Windows builds in Travis CI
* Add simple Windows platform abstraction layerSteve MacLean2020-06-0412-0/+255
| | | | | | | | Add required unix style headers as a platform abstraction layer This will allow compilation on Windows. Simple single threaded implementation of the platform abstraction layer for compilation on windows
* Add freebsd-elf* headers for WIndows compileSteve MacLean2020-06-043-0/+1362
|
* aarch64: Fix __sigset build issue on muslCDave Watson2020-05-271-1/+1
| | | | | | Described in issue #176. Taken from Alpine Linux project. Change __sigset_t to sigset_t
* Define UNW_EMPTY_STRUCT for non-GNUCSteve MacLean2020-05-212-2/+10
|
* Use C11 atomicsSteve MacLean2020-05-2116-139/+40
|
* Use C11 alignas(x)Steve MacLean2020-05-213-16/+5
|
* Use C11 _Thread_localSteve MacLean2020-05-212-10/+1
|
* Remove #include compiler.h in public headerSteve MacLean2020-05-211-2/+12
|
* Fix MSVC UNW_REMOTE_ONLY compilation errorsSteve MacLean2020-05-208-13/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix errors observed while compiling libunwind for UNW_REMOTE_ONLY, library src, amd64 & aarch64 with an amd64 MSVC compile, and arm with an x86 MSVC compiler Use standard compliant variadic macros GNUC offer non-compliant variadic macros Switch to standrds compiant variadic macros Replace non-standard statement expression GNUC statement expression is non-ISO C compliant Where a simple inline function will be equivalent, use that instead Gexpr.c support compilers w/o statement expressions For this case a simple inline function would change semantics Make a close approximation with a separate set of macros for non GNUC Fix UNW_REMOTE_ONLY placement Exclude function call not required for remote only builds Fix __attribute__((packed)) On MSVC use pragma pack() Add THREAD_LOCAL macro Avoid bare use of __thread Add MSVC fetch_and_add() support Use macro ALIGNED(x) in place of __attribute__((aligned(x)) Rename local ltoa to avoid name collision The Windows x86 SDK headers define ltoa. Rename this local function to avoid a name collision. ISO C doesn't allow empty structures Add padding to allow empty arm/aarch64 structures to compile on MSVC
* Fix error in aarch64 unw_sigcontextSteve MacLean2020-05-181-1/+1
| | | | | | | | Introduced by #71 __reseverved needs to be big enough to store a unw_fpsimd_context_t Which includes 32 128-bit registers, stored as 64 64-bit half registers. Fix off by 2x issue
* Fix signal stacks on illumos/SolarisJason King2020-04-281-2/+3
|
* Add initial support for Solaris x86-64Adeel2019-06-124-6/+18
|
* solaris portAlexander Esilevich2019-06-122-1/+3
|
* Delete hardcode of address size to support MIPS64. (#114)archerypp2019-04-241-3/+0
| | | | | Use the define for dwarf_addr_size in include/dwarf_i.h instead of hardcode(4) to support various MIPS architectures. Signed-off-by: Archer Yan <ayan@wavecomp.com>
* x86_64: Fix tdep_init_done when built with libatomic_opsDave Watson2019-04-111-0/+4
| | | | Use correct size variable.
* Tsan (#109)Dave Watson2019-04-031-0/+5
| | | x86_64: tsan clean
* Fixed a missing dependency in dwarf-eh.h Stephen Roberts2019-02-211-0/+1
| | | | | The dwarf-eh.h header is not self-contained, which causes problems depending on which order headers are included. In particular, it references the Elf_W macro but does not include its definition. If dwarf-eh.h is included after dwarf_i.h everything works, but if you reverse this order you get compile errors. This patch removes the implicit header ordering dependency by making sure the definition of Elf_W is visible in dwarf-eh.h. I include libunwind_i.h rather than the elfxx.h files directly because libunwind_i.h contains macro logic to choose which elf header to include, and I didn't want to duplicate that.
* dwarf: Push correct CFA onto stack for dwarf expression evaluation. (#93)Stephen Roberts2018-11-131-1/+1
| | | | | | | | dwarf: Push correct CFA onto stack for dwarf expression evaluation. This change fixes a bug where stale CFAs were pushed onto the dwarf expression stack before expression evaluation. Some optimising compilers emit CFI which relies on this being correct.
* aarch64: Use __asm__ instead of asm (#89)Guido Günther2018-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise this fails to compile with -stc=c99 like: $ cat <<EOF > bla.c #include <libunwind.h> int main() { unw_tdep_context_t *uc = NULL; unw_tdep_getcontext(uc); } EOF # This works $ gcc bla.c # This does not $ gcc -std=c99 bla.c In file included from /usr/include/aarch64-linux-gnu/libunwind.h:7, from bla.c:1: bla.c: In function ‘main’: bla.c:6:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asm’ unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: error: ‘mcontext_t’ {aka ‘struct <anonymous>’} has no member named ‘regs’; did you mean ‘__regs’? unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: error: ‘unw_base’ undeclared (first use in this function); did you mean ‘unw_ctx’? unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: note: each undeclared identifier is reported only once for each function it appears in bla.c:6:5: error: invalid lvalue in asm output 0 unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ See https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html: The asm keyword is a GNU extension. When writing code that can be compiled with -ansi and the various -std options, use __asm__ instead of asm (see Alternate Keywords).
* aarch64: fix freebsd supportmyfreeweb2018-08-071-0/+11
| | | implement _UPT_access_fpreg, _UCD_access_reg_freebsd for aarch64, and add a unw_fpsimd_context_t instead of using the one from the linux headers.
* s390x: fix build when long double is more than 64 bitsMichael Munday2018-06-202-5/+5
| | | | | | | | The floating point registers on s390x are 64-bits wide so type them as double precision rather than long double. Also, GCC on Ubuntu 18.04 complains about the sizeof calls so fix those too.
* mipsN32: A modification suggestion to support mips N32Deng, Yimin (NSB - CN/Shanghai)2018-04-242-1/+9
|
* aarch64: tune down size of unw_context_t and unw_cursor_t (#71)Dave Watson2018-04-101-4/+28
| | | | | | aarch64 defines a huge __reserved field in sigcontext. Cut it down to only the used FP fields. unw_cursor_t can also be cut down a bit, while still maintaining some reserved space.
* Remove unw_handle_signal_frame from header. (#70)Bert Wesarg2018-04-021-2/+0
|
* Add port to Linux on IBM Z (s390x)Michael Munday2018-01-096-0/+497
| | | | | | | | | | | | | | | | | | | | | | | | This adds a port to Linux on the IBM Z platform (a.k.a s390x). It only supports the 64-bit ABI. Most functionality is working and all the tests pass with the exception of the coredump tests*. Unwinding is only supported if DWARF unwind information is present. libunwind can't currently make use of the backchain (if present). The getcontext/setcontext functions only preserve/restore a subset of registers. Currently this only consists of callee-saved registers and some parameter registers. Vector registers and access registers are not saved (and aren't callee- saved) by getcontext and cannot currently be modified. They will however be restored unmodified after resuming a context from a signal handler. There is no special libunwind support for setjmp, the functionality is emulated using glibc (I think all the ports do this for modern Linux kernels). * Unwinding on s390x requires floating point register access which the coredump library doesn't currently support.
* ALIAS unwind_get_accessorsDave Watson2017-12-281-0/+2
|
* ALIAS dwarf symbolsDave Watson2017-12-282-1/+3
|
* Remove PROTECTED visibilityDave Watson2017-12-282-4/+1
| | | | This only works on bfd ld, not lld or gold.
* dwarf: Fix size of state to avoid corrupting rs_stackMichael Munday2017-11-281-1/+1
| | | | | | | | | | DW_CFA_remember_state used memcpy to overwrite state with the value of rs_current. Unfortunately rs_current was slightly larger than state, possibly resulting in rs_stack->next being overwritten. Fix this by making the type of state match the type of rs_current and using an assigment to perform the copy rather than memcpy. This should ensure that the types match in future.
* dwarf: Allow DWARF version both 3 and 4 (#56)Yichao Yu2017-10-311-1/+2
|