1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-19 06:17:37 +01:00
Commit graph

473 commits

Author SHA1 Message Date
Konstantin Belousov
9e97c9b17a dwarf: Make binary path calculation os-specific.
/proc/self/exe only works on Linux, move path computation to os-* files
2017-01-19 10:07:13 -08:00
Konstantin Belousov
09a598a3da Make the code compile on FreeBSD. 2017-01-18 09:18:29 -08:00
Dave Watson
a51cf49031 dwarf: Configurable cache size
Add interface for configurable dwarf cache size

* Use item size and round up to nearest power of 2.
* Initial cache still exists in BSS.  Without this, it means we would fail
  backtrace when out of memory.  The test-mem test fails without this
2017-01-13 08:36:33 -08:00
Dave Watson
29483327be x86_64: Use sigprocmask from signal frames
Currently setcontext for x86_64 restores the signal mask, even
though it is never saved anywhere.  This means the signal mask
is often garbage after an unw_resume.

(changed in commit f8a15e9679)

It looks like this was a fix for the Gtest-resume-sig function -
testing if signal masks are restored across signal frames.  The
root issue looks like that x86_64 only uses sigreturn for the exact
signal frame, and not for any decedant frames as well (as i64 does).

Instead, modify Gresume to use sigreturn if *any* frame on the stack
is a signal frame, so that we correct fixup the signal mask and any
sigaltstacks.  The sigreturn os-specific functions are changed slightly
to copy in the saved ucontext structure if we are jumping farther
up the stack.

This should fix sigprocmask reported issues such as
https://github.com/dropbox/pyston/blob/master/libunwind_patches/0002-pyston-stop-x86_64-setcontext-restoring-uninitialize.patch

Tests pass on freebsd, linux
2017-01-13 08:28:22 -08:00
Petr Malat
b707e13ca0 tests: Use strtoul in test-coredump-unwind.c
Read the address using strtoul(). If strtol() is used and the number is
bigger than LONG_MAX, LONG_MAX is returned instead, which leads to a failure
if the mapping address is 0x80000000 or larger on 32-bit platforms (and
similarly for 64-bit platforms).
2017-01-13 08:28:21 -08:00
Dave Watson
32e3e93b01 tests: Walk default test arguments to ensure child process has visibility 2017-01-13 08:28:21 -08:00
Tony Kelman
5dcb7cd3cb Fix compilation of tests on alpine linux (musl libc)
If we don't link to libexecinfo, as detected by the
AC_SEARCH_LIBS(backtrace, execinfo) configure probe, we get

```
test-coredump-unwind.o: In function `handle_sigsegv':
/home/libunwind/tests/test-coredump-unwind.c:246: undefined reference to
`backtrace_symbols_fd'
collect2: error: ld returned 1 exit status
Makefile:1187: recipe for target 'test-coredump-unwind' failed
```

and

```
Gtest-init.o: In function `do_backtrace()':
Gtest-init.cxx:(.text+0x2f): undefined reference to `_Ux86_64_getcontext'
Gtest-init.cxx:(.text+0x48): undefined reference to `_Ux86_64_init_local'
Gtest-init.cxx:(.text+0x63): undefined reference to `_Ux86_64_get_reg'
Gtest-init.cxx:(.text+0x96): undefined reference to `_Ux86_64_get_proc_name'
Gtest-init.cxx:(.text+0x171): undefined reference to `_Ux86_64_step'
collect2: error: ld returned 1 exit status
Makefile:1063: recipe for target 'Gtest-init' failed
```

There are 2 XFAIL and 6 FAIL tests, but it's a start
2017-01-13 08:28:21 -08:00
Mike Frysinger
67d4137ba7 tests: simplify make variables a bit
Add dummy assign statements at the top so we don't have to trace all
the different if paths to see where the value is initially assigned.
Now all code paths just append it.
2017-01-13 08:27:40 -08:00
Dave Watson
7d30e028a2 Don't build dyn tests on non-ia64
It looks like the dynamic frame support isn't fully baked on
non-ia64, leading to lots of mailing list comments about broken
tests (even though they're marked as supposed to fail, it's still
confusing).
2017-01-06 15:43:35 -08:00
Andreas Schwab
544cdb3b43 tests/Gtest-trace.c: show differing addresses 2015-03-22 00:05:14 -07:00
Gregory Fong
0bed10aa21 Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on ARM
This is similar to commit c90a2e02b3
"Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on MIPS".
Starting with 2.6.39, ARM Linux returns -EIO for PTRACE_SINGLESTEP, so
we need to mark this as XFAIL for ARM too.

The Linux commit that changed this is

   commit 425fc47adb5bb69f76285be77a09a3341a30799e
   Author: Will Deacon <will.deacon@arm.com>
   Date:   Mon Feb 14 14:31:09 2011 +0100

       ARM: 6668/1: ptrace: remove single-step emulation code

see: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=425fc47adb5bb69f76285be77a09a3341a30799e

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
2015-02-21 13:00:34 -08:00
Simon Atanasyan
c90a2e02b3 Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on MIPS
Though PTRACE_SINGLESTEP is defined on MIPS Linux, the kernel does
not support that kind of request. The ptrace call failed and sets
errno to EIO and paused process is not resumed. In case of
run-ptrace-mapper and run-ptrace-misc this leads to hanged execution
because next call to wait4 never returns.

This change adds run-ptrace-mapper and run-ptrace-misc to the list
of 'expected failed' tests on MIPS targets.

Signed-off-by: Simon Atanasyan <simon@atanasyan.com>
2014-10-24 22:31:05 -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
Ulrich Weigand
4c62c4a955 Fix test case link failure on PowerPC systems with Altivec
On systems where the system compiler supports Altivec by default,
the libunwind Makefile will attempt to build an extra test case
ppc64-test-altivec.  Unfortunately, the link step will fail since
the Makefile does not actually link against the libunwind library.

Fixed by adding the appropriate LDADD macro.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
2013-12-27 07:08:50 -08:00
Matt Fischer
61fad17d29 Build crasher test only when coredump support is enabled
The crasher test is used as part of the coredump test suite,
but is being built regardless of whether that support has been
configured or not.  This patch changes the build so that it is
only built when coredump support is enabled.
2013-04-19 17:08:09 -05:00
Matt Fischer
563b0ff314 Added --enable-setjmp
Currently, libunwind-setjmp is built whenever local unwinding is
built.  This patch adds an explicit flag to control it instead.
The default if not specified is to follow the old behavior.
2013-04-19 17:08:03 -05:00
Matt Fischer
abb0957198 Added --enable-ptrace
This change adds a manual override to control building of the ptrace
library, similar to the existing --enable-coredump option.  The
default is set based on the existence of sys/ptrace.h, allowing it
to be automatically disabled for platforms that do not have ptrace.
2013-04-19 16:46:24 -05:00
Arun Sharma
ae3dd9417a Add known test failures to XFAIL_TESTS 2012-10-27 19:37:45 -07:00
Tommi Rantala
6456da2dc1 Assign `func' just once in Ltest-nocalloc glibc case 2012-09-28 14:51:22 +03:00
Tommi Rantala
65f936402d Add arguments to malloc and calloc prototypes in Ltest-nocalloc 2012-09-28 14:51:22 +03:00
Tommi Rantala
249ff2f840 Remove unused variable in Ltest-nocalloc 2012-09-28 14:51:22 +03:00
Tommi Rantala
e9f161a677 Replace empty argument lists with `void' in tests 2012-09-28 14:51:22 +03:00
Tommi Rantala
890e23eb9d Prefer NULL over zero 2012-09-28 14:51:21 +03:00
Tommi Rantala
2fbbf276b3 Use shared `ARRAY_SIZE' in IA64 tests 2012-09-28 14:51:21 +03:00
Tommi Rantala
6b55e0ab51 Use `UNUSED' in tests 2012-09-28 14:51:21 +03:00
Tommi Rantala
5e7e890a0b Plug in `ALIAS' attribute 2012-09-28 14:51:21 +03:00
Tommi Rantala
e3e49dc28a Define and use `NOINLINE' 2012-09-28 14:51:19 +03:00
Tommi Rantala
ded94b98ff Stop including `memory.h'
I am unable to find any reference to `memory.h' in the C99 and C11
committee drafts, so include `string.h' instead when we need memset() or
similar.
2012-09-28 14:50:03 +03:00
Tommi Rantala
58354c94d7 Nuke HAVE_BACKTRACE
We do not really need to care if the system provides `backtrace()',
since we will want to test the one provided in libunwind, not the one
that is provided by the system. The `backtrace()' calls should already
be aliased to `unw_backtrace()', but if that is not working for whatever
reason, we can call `unw_backtrace()' explicitly.
2012-09-28 14:50:03 +03:00
Tommi Rantala
848ad53a47 Call snprintf() from signal handler only if required in test-async-sig
snprintf() is not guaranteed to be safely callable from a signal
handler, so avoid calling it in the default non-verbose case.
2012-09-28 14:50:03 +03:00
Tommi Rantala
7263a97ced Roll test-nocalloc' into Ltest-nocalloc.c'
We are building only a UNW_LOCAL_ONLY build of `test-nocalloc', and the
"generic" build would not be very interesting. Roll the whole test into
`Ltest-nocalloc.c'.
2012-09-28 14:50:03 +03:00
Tommi Rantala
aeb1afc65d Call `unw_backtrace()' explicitly in test-flush-cache.c 2012-09-28 14:50:03 +03:00
Tommi Rantala
643fc92e91 Rename rs-race' to Lrs-race'
Only build a "local-only" version of `rs-race'. The "generic" build is
not very entertaining, as the `unw_set_caching_policy()' calls
manipulate the `unw_local_addr_space' in libunwind-$arch.so, while the
`backtrace()' calls use the address space object from libunwind.so
behind the scenes.
2012-09-28 14:50:03 +03:00
Tommi Rantala
0d7738ed4f Cleanup dynamically allocated memory before exit in tests
Cleanup dynamically allocated memory before exit in tests in a few
places where missing. While such cleanups right before exit do not
usually make much sense (as the operating system would cleanup anyway,
so manual cleanups only burn CPU cycles), we will want to catch any
potential problems in libunwind related to the cleanups. This also stops
valgrind complaining about unreleased memory.
2012-09-28 14:50:02 +03:00
Tommi Rantala
438d9de675 Remove unneeded `config.h' inclusion in Gtest-nomalloc 2012-09-28 14:50:02 +03:00
Tommi Rantala
be230add88 Rename test-varargs' to Ltest-varargs'
This testcase only uses the local-only `unw_backtrace()' from libunwind,
and a "generic" build of this test case would not be interesting.
2012-09-28 14:50:02 +03:00
Tommi Rantala
939a5e195e Annotate potentially unused variable in tests/test-coredump-unwind.c
tests/test-coredump-unwind.c: In function 'handle_sigsegv':
test-coredump-unwind.c:216:15: warning: variable 'uc' set but not used [-Wunused-but-set-variable]
2012-09-28 14:06:07 +03:00
Tommi Rantala
7673df21ff Annotate potentially unused variable in tests/Gtest-trace.c
tests/Gtest-trace.c: In function 'sighandler':
tests/Gtest-trace.c:179:15: warning: unused variable 'uc' [-Wunused-variable]
2012-09-28 14:06:07 +03:00
Tommi Rantala
0c838c4d44 Annotate potentially unused variable in tests/Gtest-bt.c
tests/Gtest-bt.c: In function 'sighandler':
tests/Gtest-bt.c:158:15: warning: unused variable 'uc' [-Wunused-variable]
2012-09-28 14:06:07 +03:00
Tommi Rantala
23fdda6a28 Workaround volatileness warning in tests/ia64-test-setjmp.c
tests/ia64-test-setjmp.c:76: warning: function return types not compatible due to 'volatile'
2012-09-28 14:06:07 +03:00
Tommi Rantala
074e328d46 Avoid -Wunused-value warning in tests/Gia64-test-stack.c
tests/Gia64-test-stack.c: In function 'do_unwind_tests':
tests/Gia64-test-stack.c:91: warning: value computed is not used
2012-09-28 14:06:07 +03:00
Tommi Rantala
68b20804e4 Clear out `ip' to avoid -Wuninitialized warning in tests/test-coredump-unwind.c
This one is for architectures that we have not specifically added
support for in `tests/test-coredump-unwind.c'.

tests/test-coredump-unwind.c: In function 'handle_sigsegv':
test-coredump-unwind.c:238:10: warning: 'ip' is used uninitialized in this function [-Wuninitialized]
2012-09-28 14:06:07 +03:00
Tommi Rantala
d3fd3dc3ca Default to non-verbose mode in Ltest-cxx-exceptions 2012-09-28 14:06:07 +03:00
Konstantin Belousov
80e852cb38 Do not allow the reference to the local var to outlive the local var scope. 2012-09-21 23:06:24 -07:00
Cody P Schafer
b45c27b6ee ppc64: remove tests/ppc64-test-wchar
It is not clear what is special about wchar on PPC64, and no one can
remember why this was added.

Removing.
2012-09-15 10:47:42 -07:00
Cody P Schafer
3a5d7ff694 build: make libunwind-coredump build optional
Disable the building of libunwind-coredump except on x86_64 and x86
(where implimentations exsist).

Allow overriding of this autodetection via --enable-coredump and
--disable-coredump.
2012-09-15 10:47:42 -07:00
Tommi Rantala
1c1dbbe296 Do not print garbage proc info in tests/Gtest-bt.c
Check the return value of the unw_get_proc_info() call to avoid printing
garbage if the call fails.
2012-09-04 14:58:38 +03:00
Tommi Rantala
8203c955c8 Change test-varargs to check libunwind backtracing
test-varargs is checking how `backtrace()' provided by the system
behaves when varargs are used. Let's make the test more useful by
changing it to test the `backtrace()' provided by libunwind.

Change the testcase to return 0/1 for success/failure, and add it to the
set of checks, so that it gets run on `make check'. Also call
`unw_backtrace()' explicitly so that we do not need to bother with
`execinfo.h' and `backtrace()' prototype.
2012-09-04 14:58:38 +03:00
Tommi Rantala
ffbe29940e Check correct variable for offset in tests/Gtest-init.cxx
Checking `off' for positiveness does not make any sense, check `offset'
instead.
2012-09-04 14:58:37 +03:00
Tommi Rantala
6470a67461 Rename backtrace' to do_backtrace' in tests/Gtest-init.cxx
Rename `backtrace' to `do_backtrace' in tests/Gtest-init.cxx for sanity;
the `backtrace' name is already defined in various other places.
2012-09-04 14:58:37 +03:00