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
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.
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).
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>
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>
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>
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.
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.
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.
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.
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'.
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.
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.
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.
Fixup commit 39b83981 ("Flush icache with __builtin___clear_cache() in
tests when compiling with GCC") to fix compilation with older GCC
versions that do not provide __builtin___clear_cache().
Introduce a new test case that is derived from test-resume-sig, but
using the SA_SIGINFO sigaction() flag. This case is referred in the
linux kernel sources as "realtime" signal handler, and is handled
differently in the kernel on many architectures and in libunwind as
well.
Avoid manually coding the rule to build crasher, instead fuddle
the compiler so that even -O2 optimization does not eliminate call
to b().
First, put calls to both a() and b() in the b() into non-tail-recursive
position. Second, as recommended in gcc manual, use asm volatile("");
to prevent further prevent inlining, besides attribute((noinline).
And third, call b() by alias, which current gcc optimizer cannot see
through.
Also, do not dereference NULL in a, and mark the memory access as volatile.
[ Minor portability improvements: asharma@fb.com ]
Test that creates MiniDebugInfo-containing binary and then checks if it
can recover the procedure names from its coredump.
Signed-off-by: Martin Milata <mmilata@redhat.com>
Program test-coredump-unwind was modified to map backing files based on
virtual addresses instead of segment numbers.
The crasher.c is a program that essentially calls some functions and
then writes to invalid address causing a crash. Before that, it detects
which executables are mapped to which virtual addresses and writes this
information to a file suitable for consumption by test-coredump-unwind.
The mapping information is obtained form /proc/self/maps, so currently
it only works on linux.
The test itself is a shell script, which first runs the program and then
runs test-coredump-unwind on the resulting core and address space
map file to check whether the stack trace obtained from the dump roughly
corresponds to what it should look like.
Signed-off-by: Martin Milata <mmilata@redhat.com>
- 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>
The test-async-sig.c, test-flush-cache.c and Ltest_resume_sig.c define
UNW_LOCAL_ONLY and therefore only need LIBUNWIND_local. Gtest-dyn1.c is
calling '_U_dyn_cancel' and test-trace.c is using 'unw_backtrace' which
are in LIBUNWIND_local.
Signed-off-by: Ken Werner <ken.werner@linaro.org>
We'd like to avoid calls to all malloc related functions
so libunwind is still usable from such allocators.
Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Adds new function to perform a pure stack walk without unwinding,
functionally similar to backtrace() but accelerated by an address
attribute cache the caller maintains across calls.
This test case relies on old libunwind internals such as the arm_stackframe.
Since the ARM extbtl-parser now operates on the DWARF model directly the
arm-extbl-test isn't of any particular use anymore.
Signed-off-by: Ken Werner <ken.werner@linaro.org>
This adds support for linkers that do not pull in the dependent shared
libraries of libunwind-$(arch).la and libunwind-setjmp.la implicitly.
Signed-off-by: Ken Werner <ken.werner@linaro.org>
Eliminates unused libraries from test program linking. Substitutes
'$(top_builddir)' for '..' to clarify library locations.
Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>