[PATCH 0/9] using libdw as an alternative unwinder

Masatake YAMATO yamato at redhat.com
Tue Mar 13 17:28:05 UTC 2018


This patch set make strace utilize libdw of elfutils as an alternative
unwinder. This is mostly based on

https://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=dfefa9f057857735a073ea655f5cb34351032c8e

written by Mark Wielaard <mjw at redhat.com>.

If both unwinders(libunwind and libdw) are linked to strace, you can
choose one with -klibunwind or -klibdw option.

Example output:

    [yamato at master]~/var/strace% ./strace  -e open -klibunwind ls > /dev/null
    open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
     > /usr/lib64/libc-2.26.so(_nl_load_locale_from_archive+0x433) [0x2e333]
     > /usr/lib64/libc-2.26.so(_nl_find_locale+0xf4) [0x2cef4]
     > /usr/lib64/libc-2.26.so(setlocale+0x1ee) [0x2c6de]
     > /usr/bin/ls(_init+0x75c) [0x3c4c]
     > /usr/lib64/libc-2.26.so(__libc_start_main+0xea) [0x2100a]
     > /usr/bin/ls(_init+0x205a) [0x554a]
    open(".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
     > /usr/lib64/libc-2.26.so(opendir+0x33) [0xd6a23]
     > /usr/bin/ls(_init+0x6e08) [0xa2f8]
     > /usr/bin/ls(_init+0x13ad) [0x489d]
     > /usr/lib64/libc-2.26.so(__libc_start_main+0xea) [0x2100a]
     > /usr/bin/ls(_init+0x205a) [0x554a]
    +++ exited with 0 +++

    [yamato at master]~/var/strace% ./strace  -e open -klibdw ls > /dev/null
    open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
     > /usr/lib64/libc-2.26.so(_nl_load_locale_from_archive+0x433) [0x2e333]
     > /usr/lib64/libc-2.26.so(_nl_find_locale+0xf3) [0x2cef3]
     > /usr/lib64/libc-2.26.so(setlocale+0x1ed) [0x2c6dd]
     > /usr/bin/ls(main+0x3b) [0x3c4b]
     > /usr/lib64/libc-2.26.so(__libc_start_main+0xe9) [0x21009]
     > /usr/bin/ls(_start+0x29) [0x5549]
    open(".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
     > /usr/lib64/libc-2.26.so(opendir+0x33) [0xd6a23]
     > /usr/bin/ls(print_dir+0x47) [0xa2f7]
     > /usr/bin/ls(main+0xc8c) [0x489c]
     > /usr/lib64/libc-2.26.so(__libc_start_main+0xe9) [0x21009]
     > /usr/bin/ls(_start+0x29) [0x5549]
    +++ exited with 0 +++

Masatake YAMATO (9):
  unwind: make the field type of struct tcb libunwind independent
  unwind: give the field in tcb used for unwinding longer name
  unwind: introduce an ifdef condition, CAN_UNWIND as the super-set of
    USE_LIBUNWIND
  unwind: rename public functions object-oriented
  unwind: split unwind codes into front-end and back-end
  unwind: allow to specify unwinder back-end with -k option
  unwind: add libdw as a unwinder
  add "stack-unwind-with-libunwind" and "stack-unwind-with-libdw" as
    features
  strace.1.in: write about optional option parameter for -k

 Makefile.am         |  22 ++++-
 configure.ac        |  51 +++++++++-
 defs.h              |  16 +--
 stacktrace-libdw.c  |   0
 strace.1.in         |   9 +-
 strace.c            |  31 +++---
 syscall.c           |   8 +-
 tests/strace-V.test |   5 +-
 unwind-libdw.c      | 203 ++++++++++++++++++++++++++++++++++++++
 unwind-libunwind.c  | 174 ++++++++++++++++++++++++++++++++
 unwind.c            | 279 ++++++++++++++++++++--------------------------------
 unwind.h            |  74 ++++++++++++++
 12 files changed, 667 insertions(+), 205 deletions(-)
 create mode 100644 stacktrace-libdw.c
 create mode 100644 unwind-libdw.c
 create mode 100644 unwind-libunwind.c
 create mode 100644 unwind.h

-- 
2.14.3



More information about the Strace-devel mailing list