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.
Allow IA64 cross-compilation

Change the way we generate the cursor header files, so that we do not
need to invoke IA64 binaries, which would fail when cross-compiling
libunwind.

Adopt the strategy used in the Linux kernel build system, and parse our
annotated offset information from the assembler file produced by the
compiler.
IA64: use tdep_find_unwind_table() in coredump lib

Fixup commit d93d96ad833390519ea68a2df22dd55dd26a3214 ("Fix compilation
on IA64"), and replace the dwarf_find_unwind_table() call with
tdep_find_unwind_table().

Fixes linkage error on IA64:
../src/.libs/libunwind-coredump.so: undefined reference to `dwarf_find_unwind_table'
Fix --enable-debug-frame build

dwarf/Gfind_unwind_table.c: In function '_Ux86_dwarf_find_unwind_table':
dwarf/Gfind_unwind_table.c:223:46: error: 'struct elf_dyn_info' has no member named 'edi'
IA64: `ent' needed conditionally in Gtables.c

ia64/Gtables.c: In function '_ULia64_search_unwind_table':
ia64/Gtables.c:258: warning: unused variable 'ent'
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.
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 24112f6d9b87554fe18b1ca0f939f30c76ac38fa ("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 *'
Fix typo in unw_get_proc_name documentation
Fix some compiler warnings
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
Fix a SIGSEGV in test-ptrace.c

./test-ptrace -v resulted in a SIGSEGV.
Fix incorrect return code of unw_get_proc_name

The code for symbol lookup (elfxx.c:lookup_symbol) works by iterating
over symbol tables while maintaing the symbol closest to the supplied
instruction pointer. Whenever this search encountered symbol that was
longer than result buffer, the function returned -UNW_ENOMEM even though
the final symbol wasn't too long.

Signed-off-by: Martin Milata <mmilata@redhat.com>
Make coredump test also test unw_get_proc_name

Signed-off-by: Martin Milata <mmilata@redhat.com>
Add liblzma detection to configure script

Signed-off-by: Martin Milata <mmilata@redhat.com>
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>
Refactor parts of elfxx.c to allow reusing code

Signed-off-by: Martin Milata <mmilata@redhat.com>
Search MiniDebugInfo for procedure names

After searching the normal symbol table, look if the binary contains
.gnu_debugdata section. If it does, run LZMA decompression on it, load
the resulting ELF image into memory and call lookup_symbol() on it
again.

lookup_symbol() is modified so that it takes min_dist as a parameter and
only returns a symbol when it finds one that is closer than indicated by
the parameter.

Signed-off-by: Martin Milata <mmilata@redhat.com>
Fix test-ptrace in automated mode

Tested via:
./test-ptrace
./test-ptrace -v /bin/ls /usr
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 ]
Use libtool to build libunwind-ptrace