[8/9,libbacktrace] Add btest_dwz test-case

Message ID 20181211101411.7067-9-tdevries@suse.de
State New
Headers show
Series
  • Handle .gnu_debugaltlink
Related show

Commit Message

Tom de Vries Dec. 11, 2018, 10:14 a.m.
2018-11-11  Tom de Vries  <tdevries@suse.de>

	* 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.
---
 libbacktrace/Makefile.am  | 12 ++++++++++
 libbacktrace/Makefile.in  | 29 ++++++++++++++++++------
 libbacktrace/configure    | 57 +++++++++++++++++++++++++++++++++++++++++++++--
 libbacktrace/configure.ac |  3 +++
 4 files changed, 92 insertions(+), 9 deletions(-)

-- 
2.16.4

Comments

Ian Lance Taylor Jan. 16, 2019, 1:19 a.m. | #1
On Tue, Dec 11, 2018 at 2:16 AM Tom de Vries <tdevries@suse.de> wrote:
>

> 2018-11-11  Tom de Vries  <tdevries@suse.de>

>

>         * 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.


> diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am

> index 1a3680bc98c..497cc2f5c97 100644

> --- a/libbacktrace/Makefile.am

> +++ b/libbacktrace/Makefile.am

> @@ -157,6 +157,18 @@ btest_alloc_LDADD = libbacktrace_alloc.la

>

>  check_PROGRAMS += btest_alloc

>

> +if HAVE_DWZ

> +

> +%_dwz: %

> +       rm -f $@_common.debug

> +       cp $< $@

> +       cp $< $@_2

> +       $(DWZ) -m $@_common.debug $@ $@_2


This doesn't look right.  A Makefile recipe must always create the
target as the very last command.  Otherwise, if the recipe is
interrupted for any reason, such as, in this case, a failure to run
dwz, then when you run make again it will think that the recipe has
already been run.

Ian
Tom de Vries Jan. 16, 2019, 4:39 p.m. | #2
On 16-01-19 02:19, Ian Lance Taylor wrote:
> On Tue, Dec 11, 2018 at 2:16 AM Tom de Vries <tdevries@suse.de> wrote:

>>

>> 2018-11-11  Tom de Vries  <tdevries@suse.de>

>>

>>         * 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.

> 

>> diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am

>> index 1a3680bc98c..497cc2f5c97 100644

>> --- a/libbacktrace/Makefile.am

>> +++ b/libbacktrace/Makefile.am

>> @@ -157,6 +157,18 @@ btest_alloc_LDADD = libbacktrace_alloc.la

>>

>>  check_PROGRAMS += btest_alloc

>>

>> +if HAVE_DWZ

>> +

>> +%_dwz: %

>> +       rm -f $@_common.debug

>> +       cp $< $@

>> +       cp $< $@_2

>> +       $(DWZ) -m $@_common.debug $@ $@_2

> 

> This doesn't look right.  A Makefile recipe must always create the

> target as the very last command.  Otherwise, if the recipe is

> interrupted for any reason, such as, in this case, a failure to run

> dwz, then when you run make again it will think that the recipe has

> already been run.


Fixed.

Thanks,
- Tom
[libbacktrace] Add btest_dwz test-case

Add test-case to verify that libbacktrace can read debug info that was
compressed with dwz.

2018-11-11  Tom de Vries  <tdevries@suse.de>

	* 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.

---
 libbacktrace/Makefile.am  | 13 +++++++++++
 libbacktrace/Makefile.in  | 33 ++++++++++++++++++++-------
 libbacktrace/configure    | 57 +++++++++++++++++++++++++++++++++++++++++++++--
 libbacktrace/configure.ac |  3 +++
 4 files changed, 96 insertions(+), 10 deletions(-)

diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index 527353aa3f0..0331e9272e8 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -178,6 +178,19 @@ 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
+	cp $@_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 c595a8b4a3e..a7fa47fdb52 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 # Makefile.am -- Backtrace Makefile.
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -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,13 @@ 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@	cp $@_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
Ian Lance Taylor Jan. 16, 2019, 6:29 p.m. | #3
On Wed, Jan 16, 2019 at 8:39 AM Tom de Vries <tdevries@suse.de> wrote:
>

> On 16-01-19 02:19, Ian Lance Taylor wrote:

> > On Tue, Dec 11, 2018 at 2:16 AM Tom de Vries <tdevries@suse.de> wrote:

> >>

> >> 2018-11-11  Tom de Vries  <tdevries@suse.de>

> >>

> >>         * 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.

> >

> >> diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am

> >> index 1a3680bc98c..497cc2f5c97 100644

> >> --- a/libbacktrace/Makefile.am

> >> +++ b/libbacktrace/Makefile.am

> >> @@ -157,6 +157,18 @@ btest_alloc_LDADD = libbacktrace_alloc.la

> >>

> >>  check_PROGRAMS += btest_alloc

> >>

> >> +if HAVE_DWZ

> >> +

> >> +%_dwz: %

> >> +       rm -f $@_common.debug

> >> +       cp $< $@

> >> +       cp $< $@_2

> >> +       $(DWZ) -m $@_common.debug $@ $@_2

> >

> > This doesn't look right.  A Makefile recipe must always create the

> > target as the very last command.  Otherwise, if the recipe is

> > interrupted for any reason, such as, in this case, a failure to run

> > dwz, then when you run make again it will think that the recipe has

> > already been run.

>

> Fixed.


> +%_dwz: %

> +         rm -f $@_common.debug


Add $@ to the initial rm -f, so that you remove the target.

> +         cp $@_1 $@


Make this a mv.  You don't need $@_1 after this.  Also, rm $@_2 here
or in mostlyclean or something.

This is OK with those changes.

Thanks.

Ian

Patch

diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index 1a3680bc98c..497cc2f5c97 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -157,6 +157,18 @@  btest_alloc_LDADD = libbacktrace_alloc.la
 
 check_PROGRAMS += btest_alloc
 
+if HAVE_DWZ
+
+%_dwz: %
+	rm -f $@_common.debug
+	cp $< $@
+	cp $< $@_2
+	$(DWZ) -m $@_common.debug $@ $@_2
+
+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 6eaa1e28c01..0abfcb42460 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -125,11 +125,12 @@  check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
 @NATIVE_TRUE@	test_pecoff test_unknown unittest unittest_alloc \
 @NATIVE_TRUE@	btest btest_alloc stest stest_alloc ztest \
 @NATIVE_TRUE@	ztest_alloc edtest edtest_alloc
-@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_2 = -lz
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@am__append_2 = btest_dwz
 @HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_3 = -lz
-@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_4 = ttest ttest_alloc
-@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_5 = dtest
-@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_6 = ctestg ctesta \
+@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_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@	ctestg_alloc \
 @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@	ctesta_alloc
 subdir = .
@@ -620,6 +621,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@
@@ -774,7 +776,7 @@  libbacktrace_la_LIBADD = \
 	$(ALLOC_FILE)
 
 libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
-TESTS = $(check_PROGRAMS) $(am__append_5)
+TESTS = $(check_PROGRAMS) $(am__append_2) $(am__append_6)
 @NATIVE_TRUE@check_LTLIBRARIES = libbacktrace_alloc.la \
 @NATIVE_TRUE@	libbacktrace_noformat.la
 @NATIVE_TRUE@libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
@@ -809,9 +811,9 @@  TESTS = $(check_PROGRAMS) $(am__append_5)
 @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_2) \
+@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_3) \
 @NATIVE_TRUE@	$(CLOCK_GETTIME_LINK)
-@NATIVE_TRUE@ztest_alloc_LDADD = libbacktrace_alloc.la $(am__append_3) \
+@NATIVE_TRUE@ztest_alloc_LDADD = libbacktrace_alloc.la $(am__append_4) \
 @NATIVE_TRUE@	$(CLOCK_GETTIME_LINK)
 @NATIVE_TRUE@ztest_alloc_SOURCES = $(ztest_SOURCES)
 @NATIVE_TRUE@ztest_alloc_CFLAGS = $(ztest_CFLAGS)
@@ -1532,6 +1534,13 @@  ctesta_alloc.log: ctesta_alloc$(EXEEXT)
 	--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'; \
@@ -1695,6 +1704,12 @@  uninstall-am:
 @NATIVE_TRUE@		$(srcdir)/xcoff.c \
 @NATIVE_TRUE@		> $@
 
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@%_dwz: %
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@	rm -f $@_common.debug
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@	cp $< $@
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@	cp $< $@_2
+@HAVE_DWZ_TRUE@@NATIVE_TRUE@	$(DWZ) -m $@_common.debug $@ $@_2
+
 @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 c75fc9d7ebc..9f0fac80719 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