| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
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.
|
|
|
|
|
| |
Use the (former) POSIX-standard <ucontext.h> everywhere instead of sometimes
using the Linux-specxific <sys/ucontext.h>.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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];
|
|
|
|
| |
Use actual sizes from current kernels for the Windows abstraction layer
|
|
|
|
|
| |
Add CMake file for Windows build
Enable Windows builds in Travis CI
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
Described in issue #176. Taken from Alpine Linux project.
Change __sigset_t to sigset_t
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
| |
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>
|
|
|
|
| |
Use correct size variable.
|
|
|
| |
x86_64: tsan clean
|
|
|
|
|
| |
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.
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
This only works on bfd ld, not lld or gold.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|