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

420 commits

Author SHA1 Message Date
Tommi Rantala
5b55e556ca test-resume-sig-rt: test unw_resume() in presence of "realtime" signal frame
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.
2012-08-21 22:33:56 +03:00
Tommi Rantala
ff0c6ccf6b Remove unneeded length modifier from suppressed match in sscanf() format in tests/crasher.c
GCC is complaining about the `%*jx' match in sscanf() format string.
Replace it with `%*x'; sscanf() will identically match an unsigned
hexadecimal integer without the length modifier.

crasher.c: In function 'write_maps':
crasher.c:30:9: warning: use of assignment suppression and length modifier together in gnu_scanf format [-Wformat]
2012-08-21 22:30:47 +03:00
Tommi Rantala
9a6d921230 Fix plain return from main() in tests/test-async-sig.c
test-async-sig.c: In function 'main':
test-async-sig.c:185:4: warning: 'return' with no value, in function returning non-void [-Wreturn-type]
2012-08-21 22:30:46 +03:00
Tommi Rantala
56f07a8e55 Stop using nonportable echo arguments in tests
echo arguments are not portable, so use printf when we need to print
tabs or newlines.
2012-08-21 22:30:46 +03:00
Tommi Rantala
f42a8de0fa Annotate unused parameters in tests
Compiling the tests with -Wextra results to lots of warnings for unused
parameters. Annotate these cases with the `unused' attribute to avoid
the warnings.
2012-08-21 22:30:46 +03:00
Tommi Rantala
47a99b6f00 Eliminate unused parameters in tests 2012-08-21 22:30:41 +03:00
Tommi Rantala
6f374ccb5a Ignore _fbss, _fdata, _ftext and _gp symbols on MIPS 2012-08-20 08:46:47 +03:00
Tommi Rantala
a63c209fed Add PPC namespace checking
PPC is the only architecture that has the get_func_addr() symbol
exported, so add specific checks for this architecture.
2012-08-20 08:46:46 +03:00
Arun Sharma
201bb8733d Use libtool to build libunwind-ptrace 2012-08-18 12:41:21 -07:00
Konstantin Belousov
04c77cced4 Fix for test suite build in the separate directory.
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 ]
2012-08-11 22:02:55 -07:00
Arun Sharma
538f63d796 Fix test-ptrace in automated mode
Tested via:
./test-ptrace
./test-ptrace -v /bin/ls /usr
2012-08-11 21:21:54 -07:00
Martin Milata
4ab9e5dd10 MiniDebugInfo test: tests/run-coredump-unwind-mdi
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>
2012-08-10 15:29:03 +02:00
Martin Milata
2dbc26dde8 Make coredump test also test unw_get_proc_name
Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-08-08 13:54:05 +02:00
Arun Sharma
707b1dba99 Fix a SIGSEGV in test-ptrace.c
./test-ptrace -v resulted in a SIGSEGV.
2012-08-04 18:06:07 -07:00
Arun Sharma
32202619c4 Fix a test failure
The test contains hints to users of unw_backtrace() and friends
on how to ensure correctness in a multi-threaded program
2012-08-04 17:58:24 -07:00
Arun Sharma
814bd79fb1 Fix some compiler warnings 2012-08-04 12:48:56 -07:00
Tommi Rantala
4bf1b71952 Use unw_context_t instead of ucontext_t in tests/Gtest-trace.c and tests/Gtest-bt.c
At least on ARM unw_context_t and ucontext_t are not the same types, so
use unw_context_t.

See also commit 24112f6d9b ("Fix some test
failures on x86_64 on distros with small default stacks.")

Gtest-trace.c: In function 'do_backtrace':
Gtest-trace.c:66:3: warning: initialization from incompatible pointer type [enabled by default]
Gtest-trace.c:67:3: warning: passing argument 2 of '_Uarm_init_local' from incompatible pointer type [enabled by default]
../include/libunwind-common.h:239:1: note: expected 'struct unw_context_t *' but argument is of type 'struct ucontext_t *'

Gtest-bt.c: In function 'do_backtrace':
Gtest-bt.c:65:3: warning: initialization from incompatible pointer type [enabled by default]
Gtest-bt.c:66:3: warning: passing argument 2 of '_Uarm_init_local' from incompatible pointer type [enabled by default]
../include/libunwind-common.h:239:1: note: expected 'struct unw_context_t *' but argument is of type 'struct ucontext_t *'
2012-07-31 16:21:15 +03:00
Tommi Rantala
9158e522db Fix IP vs. PC confusion in tests on ARM
The intention in the test cases is to print the "instruction pointer"
value at certain places, and on ARM we will want to get the Program
Counter in these cases. IP is a scratch register, and not very
interesting.
2012-07-31 16:21:15 +03:00
Tommi Rantala
a06f189baf Rip out AC_TYPE_SIGNAL and sighandler_t check
AC_TYPE_SIGNAL is an obsolete autoconf macro, and we were not using
sighandler_t or RETSIGTYPE for anything anyways.
2012-07-31 15:01:02 +03:00
Martin Milata
de28c51e63 Build libunwind-coredump using libtool
So that it builds shared/pic library that can be linked with other
libraries.

Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-07-04 17:01:44 -07:00
Konstantin Belousov
0f6c8313b7 Port crasher to FreeBSD. 2012-06-23 11:39:18 -07:00
Martin Milata
0f9a540c8c coredump: add test
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>
2012-05-31 11:00:40 +02:00
Konstantin Belousov
61a173763e Fix test build on FreeBSD. 2012-05-24 12:45:23 +03: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
46dfe3ecf5 Fixup whitespace in Makefile. 2012-03-14 17:20:58 -07:00
Arun Sharma
7e5d2791f9 Update namespace checks for dwarf_find_unwind_tables 2012-03-12 20:11:49 -07:00
Arun Sharma
6da4dde70e Compile fix for platforms other than linux-i386 2012-03-12 20:11:49 -07:00
Arun Sharma
f0bb806ecb Move the test case to tests dir. 2012-03-12 20:11:49 -07:00
Ken Werner
3977724e82 Add missing <signal.h> include directive
The testcase tests/Gtest-dyn1.c uses the signal() function and should
therefore include the corresponding header file.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-10-29 17:12:43 -07:00
Ken Werner
9a311bf48b [ARM] fix for the check-namespace test case
Add ARM specific symbols and ignore some symbols generated by the ARM Linux
default linker script.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-10-15 23:10:28 -07:00
Arun Sharma
42b67080eb Fix linker errors with recent binutils
Without this, tests that called unw_getcontext() got a linker error

Signed-off-by: Arun Sharma <asharma@fb.com>
2011-10-15 23:03:46 -07:00
Arun
f89fb17695 Fix incorrect calls to memset.
Found when compiling libunwind with clang.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
2011-10-02 22:43:28 -07:00
Arun Sharma
1d8e2c1ae5 Explicitly specify the libraries
Without this linking fails with gold and newer versions of ld.
2011-09-10 19:57:10 -07:00
Sven Neumann
f195c9ad52 Skip a few tests on uCLibC
Without this, the build fails on platforms that don't implement
backtrace().
2011-08-27 21:54:52 -07:00
Arun Sharma
4dbc2bcb94 Fix a compiler warning
backtrace() needs execinfo.h
2011-08-15 20:19:47 -07:00
Ken Werner
288f18f7ae ARM: tests/Gtest-dyn1.c workaround for GCC bug.
Temporarily workaround for a GCC bug that prevents code from obtaining the
thumb marker: https://bugs.launchpad.net/gcc-linaro/+bug/721531.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-21 17:25:42 +02:00
Ken Werner
3b917f2d16 ARM: tests/Gtest-dyn1.c fixes.
Define an appropriate fdesc struct and its corresponding accessors that take
care of the thumb marker on ARM. Call the __clear_cache built-in instead of
flush_cache if the GNU compiler is used.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-21 17:25:42 +02:00
Ken Werner
a624812e2a ARM: tests/Gtest-trace.c - IP printing
Print the instruction pointer on ARM as well.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-21 17:25:42 +02:00
Ken Werner
d589e20506 Add the appropriate libraries to the *_LDADD variables.
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>
2011-04-21 17:25:42 +02:00
Ken Werner
e4593e2493 Increase alternate signal stack size.
Creating an alternate signal stack with a size of SIGSTKSZ (usually 8k) is
not enough on some targets because unw_cursor_t is bigger than that already.
Since the size of unw_cursor_t is part of the ABI the UNW_TDEP_CURSOR_LEN
can't be changed without breaking existent code. Therefore size of the
alternate signal stack has been increased to 1 MiB.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-05 20:59:10 -07:00
Arun Sharma
d86155f72e Add a test to catch calls to calloc from libunwind
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>
2011-04-05 20:59:03 -07:00
Arun Sharma
4dc222cf8a Undo parts of 2f9b04e9c2
Linking to local unwind library seems to be unrelated to
failures seen earlier.
2011-04-05 13:41:29 -07:00
Lassi Tuura
5f38f35d5d Drop a call frame in tdep_trace and avoid a call to unw_step.
Dropping the extra frame for unw_backtrace itself using unw_step is
approximately 15% slower than skipping the frame in tdep_trace.  So
drop the frame in the latter, and make the function a private
implementation detail for libunwind, not an exported interface.

Also moves unw_getcontext call back into unw_backtrace to avoid an
extra call frame in case slow_backtrace does not get inlined into
unw_backtrace.
2011-04-01 00:00:39 -07:00
Lassi Tuura
50bc12afba Export unw_backtrace() and alias backtrace() to it. 2011-04-01 00:00:33 -07:00
Arun Sharma
2f9b04e9c2 Mark slow_backtrace() ALWAYS_INLINE
Also fix Makefile.am so remote unwinding tests such Gtest-trace
don't link with the local unwind library (libunwind.a).
2011-03-31 22:58:07 -07:00
Arun Sharma
27d0dbfecb Ensure tests pass on 32 bit x86. 2011-03-25 14:34:41 -07:00
Lassi Tuura
3b9fd99cb7 Assign copyright as requested by the author. 2011-03-25 00:20:49 -07:00
Arun Sharma
741a5a2149 Add some performance tests for fast backtracing. 2011-03-25 00:20:46 -07:00
Arun Sharma
7ff83c051e Fix up compilation and test failures 2011-03-24 23:32:25 -07:00
Lassi Tuura
9e98f15e9a Fast back-trace for x86_64 for only collecting the call stack.
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.
2011-03-24 22:33:17 -07:00