| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Described in issue #176. Taken from Alpine Linux project.
Change __sigset_t to sigset_t
|
| |
|
| |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
| |
Needs to be build with --enable-per-thread-cache. Default caching policy
is also UNW_CACHE_PER_THREAD than.
|
|
|
|
|
|
|
|
|
|
|
| |
The ARM Thumb implementation of unw_tdep_getcontext switches to ARM
mode (".code 32"), but doesn't switch back to Thumb mode.
In gcc, this is fine (it automatically switches back to Thumb mode
at the end of an asm block), but in clang, this causes bad assembly
output (thumb instructions generated by C/C++ code later on are
interpreted as ARM mode assembly, which can't work).
Switching back to Thumb mode manually fixes clang, and is a no-op for gcc.
|
|
|
|
| |
tdep/jmpbuf.h was not including arm-tdep/jmpbuf.h.
|
|
|
|
|
|
|
|
|
|
|
| |
Ben Avison (bavison@riscopen.org) has observed that when a synthetic
eh_frame_hdr is generated, there is no space in it for the eh_frame,
so the eh_frame value is written to, and later read from, memory that
is not assigned to this purpose, with unpredictable results.
This change adds a new field to the dwarf_eh_frame_hdr type, to
make room for that value, and adds the (packed) attribute to the
struct defintion to avoid a problem with unused space in the struct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mesa3d on ARM build with libunwind support enabled fail to build due to asm()
function used when building with -std=c99.
The gcc documentation [1] suggest to use __asm__ instead of asm.
Fixes:
https://urldefense.proofpoint.com/v2/url?u=http-3A__autobuild.buildroot.net_results_3ef_3efe156b6494e4392b6c31de447ee2c72acc1a53&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vou6lT5jmE_fWQWZZgNrsMWu4RT87QAB9V07tPHlP5U&m=BlAszRQ0vewy5vW7raCh9FmNOACKez_juz55zoiNfUs&s=4sXL6_rFriQz7qi5ygKXBIVHMc7YSdCBnkkHoi347CU&e=
[1] https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html#Alternate-Keywords
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
|
|
|
|
| |
This allows libunwind to work in situations with limited stack size (ie. fibers). 512 is still more than enough for storing the cursor with some slack. (#25)
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than using a copy of dwarf_find_proc_info that differs from it slightly.
By using dwarf_find_proc_info, a potential search of the di table is
allowed, where it is omitted now. Also, for ARM, avoid runtime
checks about which kind of unwind table search to use after dl_iterate_phdr.
A couple of Debug() warnings about ip lookup failure are lost here.
The dwarf callback struct defintion is moved to Gfind_proc_info-lsb.c,
which becomes the only source file that needs it.
|
|
|
|
|
| |
'lru' prefix used in several data fields. Drop the unnecessary fields,
and just use a simple counter to track the next cache entry to be recycled.
|
|
|
|
| |
data on/off the register state stack.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
so that it will get saved and restored with the register state. Initialize
the rs_state version of ret_addr_column at the some time the dwarf_cursor
version is initialized, and don't bother copying ret_addr_column explicitly
from cursor to cache since it's copied implicitly as part of reg_state.
Use the reg_state version in apply_reg_state, instead of the cursor version.
Which brings up the question: why do we have ret_addr_column in the dwarf_cursor?
We call find_reg_state before calling apply_reg_state, so the value of ret_addr_column
in the cursor when dwarf_step gets called gets overwritten before it is used. So
it's initial value doesn't matter. But some architectures do funky things with
cursor->ret_addr_column, even though I don't see how they matter.
So I'm not deleting dwarf_cursor->ret_addr_column, even though I suspect this
patch makes it useless.
|
|
|
|
|
| |
to a pair of arrays, to reduce internal fragmentation. Reduces storage
use by 37.5% on x86_64.
|
| |
|
|
|
|
|
| |
dwarf_reg_cache_entry, leaving in dwarf_reg_state only what
apply_reg_state needs.
|
|
|
|
|
| |
that includes next field and dwarf_reg_state, and use that
strictly for stack push/pop in run_cfi_program.
|
|
|
|
| |
dwarf_reg_state.
|
|
|
|
|
| |
the dwarf code for a procedure, and a function to apply a captured
dwarf_reg_state later.
|
|
|
|
| |
that follows the procedure.
|
| |
|
|
|
|
| |
In dwarf_make_proc_info, fix a leak in the case that create_state_record fails.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In src/ppc64/Gstep.c, we use fetch32 to fetch instruction from the
inferior process. In UNW_REMOTE case, fetch32 asserts that the
address we are fetching from is aligned.
But if the inferior is corrupt, we can get unaligned IP, and hit the assert.
Attached patch removes the assert, and makes fetch32 (and fetch16)
return -UNW_EINVAL instead.
|
|
|
|
|
| |
init_local, but *not* setting use_prev_instr.
This is necessary to correctly unwind using ucontext argument to signal handlers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The attached patch fixes a problem with Xorg on MIPS64 n32 which is explained here:
https://bugs.freedesktop.org/show_bug.cgi?id=79939
Basically, libunwind is using a word size of 64-bit for all MIPS variants.
Then, Xorg does a casting to (void *) of a 64-bit variable provided by
libunwind. Given that the size of the pointers in MIPS64 n32 is 32-bit wide,
that casting causes an error like this one:
backtrace.c:90:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libunwind already had support for local unwind on a MIPS. This patch makes
support for remote unwinding on a MIPS.
I should add a few words to the changes to _UPT_access_mem.c: On MIPS, an
unw_word_t is defined as a 64-bit integer whether it's compiled for a 32- or a
64-bit MIPS.
When doing remote unwinding using the default _UPT_accessors, dwarf_readu8()
therefore expects _UPT_access_mem() to return a 64-bit integer. However, if
compiled on a 32-bit MIPS, only 32 bits are valid upon return from
_UPT_access_mem(). The patch detects this and will in this case perform two
calls to ptrace(PTRACE_POKE/PEEK_DATA) and organize the return value according
to endianness.
|
|
|
|
|
| |
This fixes a number of compiler warnings I got when compiling for mips32el with
gcc 5.3.0.
|
|
|
|
| |
Change-Id: I32912a85c0fd02bb5e45a9eb7deb2410ded352a9
|