unw_is_signal_frame should return false/0 for bad addresses

access_mem() could fail and return a non-zero value, which callers
interpret as boolean true.

Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
dwarf: Fix memory leak

Need to clean up by calling put_unwind_info() on code paths where fetch_proc_info() fails.

Signed-off-by: Arun Sharma <asharma@fb.com>
Fix the UNW_TDEP_CURSOR_LEN for ppc32 to fix assert failure

When libunwind is built for a ppc32 target, for example the yocto distro
for qemuppc, and configured with options --enable-debug-frame and
--enable-debug, then the shortfall in the size of the 'opaque' member
of the unw_cursor_t type throws an assert in mi_init().

The calculations for the ppc32 target size of UNW_TDEP_CURSOR_LEN in
the comment block based on the register count plus overhead sum to 280
words. However, that value is not reflected in the ppc32 header, which
defines the size as 200.  Fixing the ppc32 header value to 280 makes the
unw_cursor_t type larger than struct cursor type and the assert tests
true at run-time in mi_init().

Signed-off-by Dave Lerner <dave.lerner@windriver.com>
Added --enable-ptrace

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.
Added --enable-setjmp

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.
Build crasher test only when coredump support is enabled

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.
Fix symlink install hook

During the install, symlinks are added from libunwind-<arch> to
libunwind-generic.  However, on platforms that don't support
symlinking (such as Windows), the $(LN_S) macro is defined
as 'cp -p' instead.  This works fine, except that since the
target of the symlink is a relative path, the copy will only
succeed if the current directory is the directory that contains
the file.

The solution to this problem suggested in the Autotools manual
(see http://www.gnu.org/software/automake/manual/automake.html#Extending)
is to simply cd into the correct directory first.  This patch
makes that change for the symlinks that are being made during install.

[ edit: use relative path for the link name as well ]
[PATCH] AArch64 port.
Add basic support for the QNX operating system

This change adds some special cases to allow libunwind to compile
for QNX.

* QNX's copy of <elf.h> and <link.h> reside in sys/ instead.  To deal
  with this, an AC_CHECK_HEADERS() was added to check for the files
  in both locations.
* Similarly, QNX does not have <endian.h>.  In cases where the file is
  not found, logic was added to refer to QNX-specific macros to determine
  endianness.
* The QCC compiler, which is a wrapper around GCC, cannot handle some
  standard GCC options.  Therefore, logic was added to check for QCC,
  and when it is found, to suppress the use of -lgcc, and to express the
  option -nostartfiles as -Wc,-nostartfiles instead, which is correctly
  passed on to the underlying GCC.
* Finally, the support file os-qnx.c was added, patterned after the existing
  os-*.c files.  Only local image lookup is currently supported (see the
  comments for more information), but this is sufficient for QNX, since
  ptrace is not supported there anyway, and that is the only case where the
  function is required to do remote image lookup.

Change-Id: Ie7934f94a7317bdde59335f2acd4c3a97c0384c1
Fixup long lines.
Fix a build error

<elf.h> needs to be included before the check for ELF_CLASS.
Fix unwind info freeing code in DWARF parser

The DWARF code allocates its unwind_info objects out of a
memory pool.  The code which frees the object therefore calls
the mempool freeing code.  However, there are cases where the
free code will be run with an unwind_info that was allocated
through a different mechanism (e.g. an ARM exidx table entry).
In these cases, the object should not be freed through the
mempool code.

To correct this, a check was added to ensure that the unwind_info
is of the appropriate type before passing the object along to the
mempool to be freed.
Allow for dynamic unwind table handling also on ARM
hack for static linkage