Compiling the tests with -Wextra results to lots of warnings for unused
parameters. Annotate these cases with the `unused' attribute to avoid
the warnings.
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>
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 *'
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.
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 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>
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>
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>
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>
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>
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.
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>