[PATCH 2/2] unwind: add libdw as a alternative unwinder back-end

Masatake YAMATO yamato at redhat.com
Tue Apr 10 18:14:58 UTC 2018

On Tue, 10 Apr 2018 00:43:24 +0300, "Dmitry V. Levin" <ldv at altlinux.org> wrote:
> Hi,
> On Mon, Apr 09, 2018 at 03:06:16AM +0900, Masatake YAMATO wrote:
>> * unwind-libdw.c: New source file.
>> * configure.ac: New option --with-libdw.
>>   Accept only one of --with-libdw=yes or --with-libunwind=yes.
>>   Don't check libunwind if libdw is available.
>>   (USE_LIBDW): Define.
>>   (AC_SUBST): Add libdw_CFLAGS and libdw_LIBS.
>> * Makefile.am (USE_LIBDW): New condition.
>> [USE_LIBUNWIND] (strace_SOURCES): Add unwind-libdw.c.
>> [USE_LIBUNWIND] (strace_CPPFLAGS, strace_LDADD): Append libdw_CFLAGS,
>> and strace_LDADD respectively.
> Inspired by commit elfutils-0.170-68-gafffdff29228db03e2131af577f58a22aec6c1fe,
> I played with your first patchset a bit last weekend, you can find the
> result in ldv/stacktrace branch.

Sorry to be late to preare v2 patch.
What I changed in the v2 patch are the return value of
frame_callback() and the way to detecting stack overflow in
tcb_walk. I visit the branch and I found both of them are already

> Everything looks fine except on armv7 which seems to be universally broken
> (neither libdw nor libunwind works in all distributions I tested).
> For example, libdw-based unwinder fails strace-k.test with the following
> diagnostics in rawhide scratch build:
> getpid()                                = 31248
>  > /usr/lib/libc-2.27.9000.so(__getpid+0xc) [0x9f66c]
>  > No DWARF information found
> Surprisingly, aarch64 also fails in rawhide scratch build, but this might
> be a rawhide specific issue as in other distributions strace-k.test passes
> on aarch64.
> For the reference, the rawhide scratch build is
> https://koji.fedoraproject.org/koji/taskinfo?taskID=26274471

How about install glibc-debuginfo package for the test environment?
It seems that "No DWARF information found" on the architectures is expected.

I found following comment in elfutils/tests/backtrace-subr.sh:

      check_unsupported $err $testname

      # ARM is special. It is supported, but it doesn't use .eh_frame by default
      # making the native tests fail unless debuginfo (for glibc) is installed
      # and we can fall back on .debug_frame for the CFI.
      case "`uname -m`" in
	arm* )
	  if egrep 'dwfl_thread_getframes(.*)No DWARF information found' $err; then
	   echo >&2 $testname: arm needs debuginfo installed for all libraries
	   exit 77

About the comment, "# ARM...", I found following commit log:

    commit 225dddfda38c1cd90e2daa3e72da2a9d01013336
    Author: Mark Wielaard <mjw at redhat.com>
    Date:   Sun Jan 26 20:16:48 2014 +0100

	backends: Add arm frame_nregs and set_initial_registers_tid.

	This allows CFI unwinding for ARM. It relies on having .debug_frame around
	which is always the case in our testsuite. All native backtrace tests PASS
	on arm if debuginfo (for glibc) is installed on the system. Otherwise the
	tests SKIP.

	For non-debug unwinding ARM uses EXIDX tables, not .eh_frames, which
	would have to be translated to CFI to do unwinding without .debug_frame

	Signed-off-by: Mark Wielaard <mjw at redhat.com>

Mark, could you give us any hit or comment?

> -- 
> ldv

Masatake YAMATO

More information about the Strace-devel mailing list