Hi all,
On behalf of MontaVista, CodeSourcery recently added support to
mpatrol to use libunwind (http://www.nongnu.org/libunwind/) in order
to provide backtraces for ARM and MIPS. We also ported libunwind to
ARM and MIPS targets, and added support to libunwind to read DWARF-2
.debug_frame in addition to the already supported .eh_frame. Those
libunwind changes are in the tip of the libunwind development
repository now.
Here's the patch which adds libunwind support to mpatrol. In addition
to support for libunwind this patch:
- Improves Linux shared library support on current systems, by using
dl_iterate_phdr instead of _DYNAMIC - the old mechanism was not
working on any of our test platforms.
- Fixes a problem we discovered when building mpatrol with -O0;
initsection's initializer is __mp_initsection, which is not always
defined.
- Teaches mpatrol about the ".gnu_debuglink" section supported by
current binutils (objcopy --only-keep-debug).
In order to use this patch, you will need to build and install
libunwind before mpatrol. Use of libunwind is controlled by
MP_LIBUNWIND_SUPPORT in config.h; we added support for ARM,
and enabled MP_LIBUNWIND_SUPPORT on ARM and MIPS by default.
Applications using mpatrol will need to link with or LD_PRELOAD
libunwind.so in addition to any current libraries like libbfd.so. The
mpatrol wrapper has been updated to do this automatically.
Hope this is useful! Feel free to include it in future releases.
--
Daniel Jacobowitz
CodeSourcery