1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-30 21:21:45 +02:00
Commit graph

91 commits

Author SHA1 Message Date
Michael Munday 441adc46ff Add port to Linux on IBM Z (s390x)
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.
2018-01-09 07:37:55 -08:00
Dave Watson a1437a3d27 Remove PROTECTED visibility
This only works on bfd ld, not lld or gold.
2017-12-28 08:26:42 -08:00
Konstantin Belousov fd02fd59e7 arm: FreeBSD/ARMv6 port
Sponsored by:	The FreeBSD Foundation
2017-08-24 09:08:58 -07:00
Stephen Chen 0314ff8522 aarch64: Use PTRACE_GETREGSET if available
In remote ptrace mode, we currently use PTRACE_PEEKUSER to read the registers.

PTRACE_PEEKUSER only works on x86 or arm 32 bit compatibility mode on linux. On aarch64 system,
it always return -EIO. https://github.com/torvalds/linux/blob/master/kernel/ptrace.c#L885-L1102

PTRACE_GETREGSET is the newer and more supported way of reading registers. Use that if it's available.
2017-08-07 09:33:23 -07:00
Rene Nielsen 2a5d1a6296 mips: remote unwind support
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.
2017-03-02 08:02:41 -08:00
Vitaly Kuzmichev 7885596b9c arm: ptrace: Fix order of probing unwind tables
Commit 92327a3 "ARM: prefer to unwind using DWARF info"
changes order of unwind info searching to prefer DWARF (.debug_frame)
section in prior to ARM specific (.ARM.exidx). This patch only affects
local process unwinding. Now the same is done for remote unwinding.

Sometimes probing .ARM.exidx first causes backtrace truncation
after __aeabi_ldiv0 (division by 0 handler that generates SIGFPE),
because it hits [cantunwind] generated by cross-gcc for __divsi3
function copied with __aeabi_ldiv0 from libgcc.a. Perhaps, lack of
debug info for __divsi3 causes [cantunwind], or there is a problem
converting DWARF to ARM unwind tables, but when unwinding using
DWARF, it hits proper entry, and backtrace is shown correctly.

Reported-by: Frederic Berat <fberat@de.adit-jv.com>
Signed-off-by: Vitaly Kuzmichev <Vitaly_Kuzmichev@mentor.com>
2017-01-19 10:06:24 -08:00
Arun Sharma 781d5d5263 One time whitespace fixup.
for f in $(find src include -name '*.[ch]'); do
  expand -t 8 $f > $tmp; mv $tmp $f;
done
2014-09-27 09:47:23 -07:00
Zhi-Gang Liu 790be1e40d Add TileGx platform support to libunwind.
"make check" passed.
======================================================
All 34 tests behaved as expected (2 expected failures)
======================================================
Zhi-Gang Liu @ Tilera
2014-09-08 16:21:53 -04:00
Luca Clementi af23f0a04b Add Cflags keyword to pkg-config metadata files
pkg-config metadata template files are missing Cflags keyword
which is required to properly compile against libunwind using
PKG_* autoconf macros

Acked-by: Mike Frysinger <vapier@gentoo.org>
2013-08-26 05:40:19 -07:00
Yvan Roux ac6c0a6535 [PATCH] AArch64 port. 2013-05-11 09:20:28 -06:00
Tommi Rantala 397f32a378 Plug in `ARRAY_SIZE' in ptrace code 2012-09-28 14:50:03 +03:00
Tommi Rantala a9b5b10f23 Set `_UPT_reg_offset' read only
We do not modify `_UPT_reg_offset', so let's set it `const'. Given that
the array is exported, it's technically possible that some library user
is actually modifying the content, but does not seem really all that
likely.
2012-09-28 14:50:03 +03:00
Tommi Rantala 8d5b1aeeff SuperH port
Add support for the 32bit SuperH architecture running Linux.
Specifically, support is added for SH4, and support for earlier SH
versions and to the 64bit SH5 are left out. This was tested in qemu with
a little-endian SH4 debian image & GCC 4.7 cross compiler.
2012-09-28 14:50:03 +03:00
Tommi Rantala e891591bcb ppc32: fixup cross build failure 2012-09-21 22:52:28 -07:00
Arun Sharma e4b24be9c2 pkg-config file fixups
Suggested-by: Alexander Toresson <alexander.toresson@gmail.com>
2012-09-21 22:46:01 -07:00
Alexander Toresson ea5e90fd9f Create and install pkg-config .pc files
[Edit: renamed to libunwind-generic.pc and some .pc files
 created only when needed -- asharma@fb.com]
2012-09-15 11:34:43 -07:00
Cody P Schafer 9184535486 ptrace: add more Debug to access_reg
This was useful in debugging issues with the libunwind-ptrace code on
ppc64.
2012-09-15 10:50:32 -07:00
Cody P Schafer 3d6f7479b0 ptrace: check for NULL arg.
tdep_get_func_addr in ppc64 passes NULL for the last argument of
as->access_mem.  tdep_get_func_addr is called by elf_w(lookup_symbol),
which in turn is called by elf_w(get_proc_name_in_image).

elf_w(get_proc_name_in_image) is part of the API, and is only passed an
unw_addr_space_t, not a unw_cursor_t, meaning that we cannot recover the
UPT_info on the PPC64 platform.

This could be fixed by giving libunwind the knowledge to perform
relocations itself, thus not needing to look at the running image to
determine function addresses.
2012-09-15 10:47:43 -07:00
Cody P Schafer 10abb25af4 ptrace/access_reg: print out register name on "bad register"
When we have a "bad register", print out the name of that register (if
possible) to aid in debugging.
2012-09-15 10:47:43 -07:00
Cody P Schafer 64e8a3d909 UPT: Add reg offsets for ppc32/64 2012-09-15 10:47:42 -07:00
Martin Milata d93d96ad83 Fix compilation on IA64
- Add tdep macro for {dwarf,ia64}_find_unwind_table so that ia64
   doesn't try to use dwarf code.
 - Fix extraneous #if.
 - Fix mistyped filename in Makefile.am.
 - Link ia64-specific tests with correct libraries.

Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-05-23 20:52:28 -07:00
Arun Sharma fa5409387c Merge branch 'coredump2' of https://github.com/adsharma/libunwind
Conflicts:
	src/ptrace/_UPT_find_proc_info.c
2012-05-23 20:51:50 -07:00
Arun Sharma cbc66b62c0 mips: fix a linker error
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
2012-04-09 19:48:49 -07:00
Arun Sharma 6525714c27 Move some dwarf functionality from ptrace to dwarf
Move ptrace-independent code from src/ptrace/_UPT_find_proc_info.c
to src/dwarf/{G,L}find_unwind_table.c. Name this moved function
dwarf_find_unwind_table().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2012-03-12 20:06:37 -07:00
Arun Sharma 25ee9f8172 Introduce struct elf_dyn_info
This is a common part of struct UPT_info
and struct UCD_info (to be introduced later).
Make _UPTi_find_unwind_table function operate only on this part
of struct UPT_info.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2012-03-12 20:04:19 -07:00
Ken Werner 059676cb00 Prevent the use of struct dl_phdr_info outside of dl_iterate_phdr
Since the dl_iterate_phdr is required for local unwinding only the use of
struct dl_phdr_info can be eliminated in case libunwind gets compiled for
remote unwinding. This enhances libunwinds portability to targets that
don't provide any dl_iterate_phdr functionality.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-10-29 17:12:43 -07:00
Ken Werner 197571915c Change _UPTi_find_unwind_table to return an integer.
This keeps the definition on IA64 and all the other architectures in sync with
the declaration of _UPTi_find_unwind_table. This also mimics the behaviour of
what's done for local unwinding and allows the function to provide more than
one way to undwind.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-10-15 23:10:27 -07:00
Arun Sharma 962366dace Fixup compile errors on ia64.
Suggested-by: Harald Servat <harald.servat@bsc.es>
2011-09-23 11:11:34 -07:00
Ken Werner d83846f120 ARM: Initial support for remote unwinding using libunwind-ptrace
Change _UPTi_find_unwind_table to also look for the ARM specific unwind
information. Adjust the ARM unwind code to read memory using the accessor
routines.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-15 20:12:54 +02:00
Ken Werner b317cb4829 Change libunwind-ptrace to also look for .debug_frame if nothing found in .eh_frame.
This changes the behavior of libunwind-ptrace to what we do for local
unwinding.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-15 20:12:54 +02:00
Joel Brobecker 8d991d9258 Fix call to maps_next in _UPT_get_dyn_info_list_addr.c
A previous change reduced the number of arguments that this function
tasks, but one call at least did not get updated, resulting in a build
failure on ia64-linux.  This patch fixes it.
2011-06-18 19:50:31 -07:00
Joel Brobecker e003e44a37 Check for <sys/ptrace.h> before including it
On ia64-hpux version 11.31, <sys/ptrace.h> has been removed.
This patch adds a configure check for this header file, and only
includes <sys/ptrace.h> if it exists.
2011-06-18 19:50:28 -07:00
Konstantin Belousov b3757e7792 Restore the linking when --enable-debug-frame is not specified 2010-05-29 01:07:40 +03:00
Arun Sharma 46e10c5abe Support .debug_frame based unwinding in _UPTi_find_unwind_table()
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-26 19:25:41 -07:00
Arun Sharma 8ee7b1762e Add ip argument to _UPTi_find_unwind_table.
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 12:15:49 -07:00
Arun Sharma 1787a2fd28 Add path and pathlen arguments to tdep_get_elf_image()
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 12:14:09 -07:00
Arun Sharma 66b7335ff3 Adds missing register offsets for ARM
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 11:56:37 -07:00
Giuseppe Scrivano a67654e86f [PATCH] Reduce scope of the eh_frame_end local variable 2010-04-14 12:11:29 -07:00
Konstantin Belousov 42bc15c72c Provide proper register offsets in the gregset for FreeBSD/i386 2010-04-11 19:18:07 +03:00
Konstantin Belousov a688d6c4c9 Remove unused variable. 2010-04-10 18:51:17 +03:00
Konstantin Belousov 6f7b335e89 Add my copyrights to several files that contain essential modifications 2010-04-10 01:42:26 +03:00
Konstantin Belousov 9bb9c972e6 Merge with origin/master 2010-03-31 16:01:38 +03:00
Arun Sharma 6203f1cd0f Cleanup a mapped elf image.
Without this, we end up with mmap leaks. Thanks to Humberto Abdelnur
for suggesting this.
2010-03-26 15:54:14 -07:00
Konstantin Belousov 9f79621a29 Enough for now for ptrace backend 2010-03-08 20:55:50 +02:00
Konstantin Belousov 752ce15c4f Preliminary version of freebsd syscall unwinder 2010-03-08 19:45:54 +02:00
Konstantin Belousov d7eea91448 Cast caddr_t argument for ptrace 2010-03-07 12:27:03 +02:00
Konstantin Belousov 78cb28b4a6 PT_CONTINUE. 2010-03-06 16:20:47 +02:00
Konstantin Belousov d4a4ddd23d Provide access to the general regs on FreeBSD. 2010-03-06 16:17:21 +02:00
Konstantin Belousov cf6ae3548f Code to read/write user memory on FreeBSD 2010-03-06 15:04:56 +02:00
Konstantin Belousov d11456ffbf Code to read/write fpregs on FreeBSD 2010-03-06 14:55:11 +02:00