Demote the debug level to reduce verbosity
dwarf: ip == 0 should't terminate unwind
dwarf: introduce a valid bit for dwarf_reg_state_t

Without this, cache_match() returns true when (ip == 0).
ia64: remove references to an out of scope local

This causes problems with gcc-4.7

Signed-off-by: Joel Brobecker <brobecker@adacore.com>
mips: fix a linker error

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
dwarf: Get correct return from expression evaluation

Currently the expression evaluation always succeeds,
and possible error is not propagated to the caller.

The ',' operator makes the condition always return 0.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Paul Pluzhnikov <ppluzhnikov@google.com>
freebsd: Consistently use symbolic name UNW_EUNSPEC for errors
freebsd: Fix logic error

When encountered vm map entry is not backed by a vnode, continue search
for matching entry instead of aborting the loop.
freebsd: Workaround for old FreeBSD kernels

Older kernels interpret the pid argument of the process information
sysctls as pid only. If libunwind UPT consumer passed tid to _UPT_create,
tdep_get_elf_image() returns error due to sysctls failure. Provide a
slow workaround by searching for a process owning the supplied tid if
sysctl returned ESRCH.
freebsd: Account for the possible ERESTART handling of the syscalls.
freebsd: Fix boundary conditions for non-dwarf walker on x86_64.

In the commit d04dc94cc2b0141f06ed9de1665ab89a3f549e0b, the check for
dwarf.ip == 0 was removed from non-dwarf walker in x86_64 version of
unw_step(). Apparently this broke the detection of the end of frame
chain when NULL %rbp is specified, because the case just marked
dwarf.ip as 0. Explicitly set ret to 0 to indicate the end of
iteration.
x86_64: unbreak test-ptrace

If dwarf_get returns 0 (indicating the end of call chain), we should
not override the return value to 1. This may result in the caller
continuing to unwind and getting spurious errors.
Revert "x86_64: unbreak test-ptrace"

This reverts commit c9c5a40be19f8159aff0f5f07b753d59ba65f0f9.
dwarf_get() returns 0 on success. We should continue unwinding
in that case.

TBD: investigate test-ptrace failure on some platforms.
Merge branch 'coredump2' of https://github.com/adsharma/libunwind

Conflicts:
	src/ptrace/_UPT_find_proc_info.c
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>
Fix test build on FreeBSD.
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>