[PATCHv2] print stack trace after each syscall

Dmitry V. Levin ldv at altlinux.org
Tue Jul 9 12:47:34 UTC 2013


On Mon, Jul 08, 2013 at 10:28:33PM -0700, Luca Clementi wrote:
> On Mon, Jul 8, 2013 at 3:08 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > On Mon, Jul 08, 2013 at 12:24:14AM -0700, Luca Clementi wrote:
> > [...]
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -261,6 +261,63 @@ AC_CHECK_MEMBERS([struct sigcontext.sc_hi2],,, [#include <signal.h>
> >>  # include <asm/sigcontext.h>
> >>  #endif])
> >>
> >> +
> >> +dnl stack trace with libunwind
> >> +AC_ARG_WITH([libunwind],
> >> +         [AS_HELP_STRING([--with-libunwind],
> >> +                         [libunwind is used to display system call stacktrace])],
> >> +         [case "${withval}" in
> >> +          (yes|no) enable_libunwind=$withval;;
> >> +          (*)      enable_libunwind=yes
> >> +                   libunwind_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include"
> >> +                   libunwind_LDFLAGS="-L${withval}/lib" ;;
> >> +          esac],
> >> +         [enable_libunwind=maybe])
> >
> > If the option is called --with-libunwind, then the options's argument
> > variable should be called with_libunwind.
> 
> Sorry that's a leftover from previous tests.

Also,
- there should be no need to use ${AM_CPPFLAGS} in configure.ac;
- autoconf documentation suggest using "check" instead of "maybe";
- with_libunwind=$withval is a no-op.

> >> +     saved_LDFLAGS="${LDFLAGS}"
> >> +     LDFLAGS="${LDFLAGS} ${libunwind_LDFLAGS}"
> >> +     AC_CHECK_LIB([unwind], [backtrace],
> >> +                  [libunwind_LIBS="-lunwind"],
> >> +                  [AC_MSG_FAILURE([Unable to find libunwind])])
> >> +        AC_CHECK_LIB([unwind-generic], [_U${UNWIND_ARCH}_create_addr_space],
> >> +                  [libunwind_LIBS="-lunwind-generic $libunwind_LIBS"],
> >> +                  [AC_MSG_FAILURE([Unable to find libunwind-generic])],
> >> +                  [$libunwind_LIBS])
> >> +     AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
> >> +                  [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"],
> >> +                  [AC_MSG_FAILURE([Unable to find libunwind-ptrace])],
> >> +                  [$libunwind_LIBS])
> >> +     LDFLAGS="${saved_LDFLAGS}"
> >
> > If --with-libunwind was not given and one of these symbols is not
> > available, configure should not fail.
> 
> But I enter this "if" block only if I find the headers.
> My default is: if no option is given and the headers are found it's
> like if you use --with-libunwind (then you can use --with-libunwind=no
> to disable that).
> Is that wrong?

It's not obvious for me why presence of these two header files means
--with-libunwind.  I thought the default behaviour (for the case when
neither --with-libunwind nor --without-libunwind is given) would be
--without-libunwind if no suitable libunwind found, and --with-libunwind
otherwise.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130709/5e125bc6/attachment.bin>


More information about the Strace-devel mailing list