From 10f48858e8ca925deb5002e580db511b667bc24b Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 17 Jan 2019 13:42:30 +0000 Subject: [PATCH] [libbacktrace] Add btest_dwz test-case Add test-case to verify that libbacktrace can read debug info that was compressed with dwz. 2019-01-17 Tom de Vries PR libbacktrace/82857 * configure.ac (DWZ): Set with AC_CHECK_PROG. (HAVE_DWZ): Set with AM_CONDITIONAL. * configure: Regenerate. * Makefile.am (TESTS): Add btest_dwz. * Makefile.in: Regenerate. From-SVN: r268032 --- libbacktrace/ChangeLog | 9 +++++++ libbacktrace/Makefile.am | 14 ++++++++++ libbacktrace/Makefile.in | 32 +++++++++++++++++----- libbacktrace/configure | 57 +++++++++++++++++++++++++++++++++++++-- libbacktrace/configure.ac | 3 +++ 5 files changed, 106 insertions(+), 9 deletions(-) diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 191bfa3cac3..54c4b79d623 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,12 @@ +2019-01-17 Tom de Vries + + PR libbacktrace/82857 + * configure.ac (DWZ): Set with AC_CHECK_PROG. + (HAVE_DWZ): Set with AM_CONDITIONAL. + * configure: Regenerate. + * Makefile.am (TESTS): Add btest_dwz. + * Makefile.in: Regenerate. + 2019-01-17 Tom de Vries PR libbacktrace/82857 diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index 527353aa3f0..bf90ebdb2d5 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -178,6 +178,20 @@ btest_alloc_LDADD = libbacktrace_alloc.la check_PROGRAMS += btest_alloc +if HAVE_DWZ + +%_dwz: % + rm -f $@ $@_common.debug + cp $< $@_1 + cp $< $@_2 + $(DWZ) -m $@_common.debug $@_1 $@_2 + rm -f $@_2 + mv $@_1 $@ + +TESTS += btest_dwz + +endif HAVE_DWZ + stest_SOURCES = stest.c stest_LDADD = libbacktrace.la diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in index 17e7ea86879..d55e0501171 100644 --- a/libbacktrace/Makefile.in +++ b/libbacktrace/Makefile.in @@ -126,11 +126,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) @NATIVE_TRUE@ allocfail btest btest_alloc stest stest_alloc \ @NATIVE_TRUE@ ztest ztest_alloc edtest edtest_alloc @NATIVE_TRUE@am__append_2 = allocfail.sh -@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_3 = -lz +@HAVE_DWZ_TRUE@@NATIVE_TRUE@am__append_3 = btest_dwz @HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_4 = -lz -@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_5 = ttest ttest_alloc -@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_6 = dtest -@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_7 = ctestg ctesta \ +@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_5 = -lz +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_6 = ttest ttest_alloc +@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_7 = dtest +@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_8 = ctestg ctesta \ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctestg_alloc \ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta_alloc subdir = . @@ -632,6 +633,7 @@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DWZ = @DWZ@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -786,7 +788,8 @@ libbacktrace_la_LIBADD = \ $(ALLOC_FILE) libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) -TESTS = $(check_PROGRAMS) $(am__append_2) $(am__append_6) +TESTS = $(check_PROGRAMS) $(am__append_2) $(am__append_3) \ + $(am__append_7) @NATIVE_TRUE@check_LTLIBRARIES = libbacktrace_alloc.la \ @NATIVE_TRUE@ libbacktrace_noformat.la \ @NATIVE_TRUE@ libbacktrace_instrumented_alloc.la @@ -831,9 +834,9 @@ TESTS = $(check_PROGRAMS) $(am__append_2) $(am__append_6) @NATIVE_TRUE@stest_alloc_LDADD = libbacktrace_alloc.la @NATIVE_TRUE@ztest_SOURCES = ztest.c testlib.c @NATIVE_TRUE@ztest_CFLAGS = -DSRCDIR=\"$(srcdir)\" -@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_3) \ +@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_4) \ @NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) -@NATIVE_TRUE@ztest_alloc_LDADD = libbacktrace_alloc.la $(am__append_4) \ +@NATIVE_TRUE@ztest_alloc_LDADD = libbacktrace_alloc.la $(am__append_5) \ @NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) @NATIVE_TRUE@ztest_alloc_SOURCES = $(ztest_SOURCES) @NATIVE_TRUE@ztest_alloc_CFLAGS = $(ztest_CFLAGS) @@ -1575,6 +1578,13 @@ allocfail.sh.log: allocfail.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +btest_dwz.log: btest_dwz + @p='btest_dwz'; \ + b='btest_dwz'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) dtest.log: dtest @p='dtest'; \ b='dtest'; \ @@ -1743,6 +1753,14 @@ uninstall-am: @NATIVE_TRUE@allocfail.sh: allocfail +@HAVE_DWZ_TRUE@@NATIVE_TRUE@%_dwz: % +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ rm -f $@ $@_common.debug +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ cp $< $@_1 +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ cp $< $@_2 +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ $(DWZ) -m $@_common.debug $@_1 $@_2 +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ rm -f $@_2 +@HAVE_DWZ_TRUE@@NATIVE_TRUE@ mv $@_1 $@ + @NATIVE_TRUE@edtest2_build.c: gen_edtest2_build; @true @NATIVE_TRUE@gen_edtest2_build: $(srcdir)/edtest2.c @NATIVE_TRUE@ cat $(srcdir)/edtest2.c > tmp-edtest2_build.c diff --git a/libbacktrace/configure b/libbacktrace/configure index c316dde1ad2..2ea112bde68 100755 --- a/libbacktrace/configure +++ b/libbacktrace/configure @@ -672,6 +672,9 @@ LD FGREP SED LIBTOOL +HAVE_DWZ_FALSE +HAVE_DWZ_TRUE +DWZ RANLIB MAINT MAINTAINER_MODE_FALSE @@ -5366,6 +5369,52 @@ case "$AWK" in "") as_fn_error $? "can't build without awk" "$LINENO" 5 ;; esac +# Extract the first word of "dwz", so it can be a program name with args. +set dummy dwz; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DWZ+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DWZ"; then + ac_cv_prog_DWZ="$DWZ" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DWZ="dwz" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DWZ=$ac_cv_prog_DWZ +if test -n "$DWZ"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DWZ" >&5 +$as_echo "$DWZ" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$DWZ" != ""; then + HAVE_DWZ_TRUE= + HAVE_DWZ_FALSE='#' +else + HAVE_DWZ_TRUE='#' + HAVE_DWZ_FALSE= +fi + + case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -11440,7 +11489,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11443 "configure" +#line 11492 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11546,7 +11595,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11549 "configure" +#line 11598 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13558,6 +13607,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then + as_fn_error $? "conditional \"HAVE_DWZ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_PTHREAD_TRUE}" && test -z "${HAVE_PTHREAD_FALSE}"; then as_fn_error $? "conditional \"HAVE_PTHREAD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac index c992675c621..c64bf3473bb 100644 --- a/libbacktrace/configure.ac +++ b/libbacktrace/configure.ac @@ -78,6 +78,9 @@ case "$AWK" in "") AC_MSG_ERROR([can't build without awk]) ;; esac +AC_CHECK_PROG(DWZ, dwz, dwz) +AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "") + LT_INIT AM_PROG_LIBTOOL -- 2.30.2