libbacktrace: avoid infinite recursion

We could get an infinite recursion in an odd case in which a
.gnu_debugdata section was added to a debug file, and mini_debuginfo
was put into the debug file, and the debug file was put into a
/usr/lib/debug directory to be found by build ID.  This combination
doesn't really make sense but we shouldn't get an infinite recursion.

	* elf.c (elf_add): Don't use .gnu_debugdata if we are already
	reading a debuginfo file.
	* Makefile.am (m2test_*): New test targets.
	(CHECK_PROGRAMS): Add m2test.
	(MAKETESTS): Add m2test_minidebug2.
	(%_minidebug2): New pattern.
	(CLEANFILES): Remove minidebug2 files.
	* Makefile.in: Regenerate.
This commit is contained in:
Ian Lance Taylor 2024-07-11 19:29:04 -07:00
parent 3bc1a86d53
commit bf406a5369
3 changed files with 134 additions and 42 deletions

View File

@ -594,6 +594,39 @@ MAKETESTS += mtest_minidebug
$(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg.xz $<.strip
mv $<.strip $@
if HAVE_ELF
if HAVE_BUILDID
if HAVE_OBJCOPY_DEBUGLINK
m2test_SOURCES = $(mtest_SOURCES)
m2test_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
m2test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags)
m2test_LDADD = libbacktrace_elf_for_test.la
check_PROGRAMS += m2test
MAKETESTS += m2test_minidebug2
# minidebug2 is like minidebug but also adds the gnu_debugdata section
# to the debug file, and uses a build ID file. There is no reason to do
# this but it was causing an infinite recursion.
%_minidebug2: %
$(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms2
$(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms2
$(COMM) -13 $<.dsyms2 $<.fsyms2 > $<.keepsyms2
$(OBJCOPY) --only-keep-debug $< $<.dbg2
$(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms2 $<.dbg2 $<.mdbg2
$(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip2
rm -f $<.mdbg2.xz
$(XZ) $<.mdbg2
$(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.dbg2
$(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.strip2
$(SHELL) ./install-debuginfo-for-buildid.sh $(TEST_BUILD_ID_DIR) $<.dbg2
mv $<.strip2 $@
endif HAVE_OBJCOPY_DEBUGLINK
endif HAVE_BUILDID
endif HAVE_ELF
endif HAVE_MINIDEBUG
endif NATIVE
@ -629,7 +662,8 @@ TESTS += $(MAKETESTS) $(BUILDTESTS)
CLEANFILES = \
$(MAKETESTS) $(BUILDTESTS) *.debug elf_for_test.c edtest2_build.c \
gen_edtest2_build \
*.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip
*.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip \
*.dsyms2 *.fsyms2 *.keepsyms2 *.dbg2 *.mdbg2 *.mdbg2.xz *.strip2
clean-local:
-rm -rf usr

View File

@ -121,8 +121,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
$(am__EXEEXT_16)
TESTS = $(am__append_4) $(MAKETESTS) $(am__EXEEXT_16)
$(am__EXEEXT_4) $(am__EXEEXT_17)
TESTS = $(am__append_4) $(MAKETESTS) $(am__EXEEXT_17)
@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_1 = libbacktrace_elf_for_test.la
@NATIVE_TRUE@am__append_2 = test_elf_32 test_elf_64 test_macho \
@NATIVE_TRUE@ test_xcoff_32 test_xcoff_64 test_pecoff \
@ -163,9 +163,11 @@ TESTS = $(am__append_4) $(MAKETESTS) $(am__EXEEXT_16)
@NATIVE_TRUE@am__append_28 = mtest
@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_29 = mtest.dSYM
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@am__append_30 = mtest_minidebug
@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_31 = -llzma
@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_32 = -llzma
@HAVE_ELF_TRUE@am__append_33 = xztest xztest_alloc
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_31 = m2test
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_32 = m2test_minidebug2
@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_33 = -llzma
@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_34 = -llzma
@HAVE_ELF_TRUE@am__append_35 = xztest xztest_alloc
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/cet.m4 \
@ -224,35 +226,36 @@ libbacktrace_noformat_la_OBJECTS = \
@NATIVE_TRUE@am__EXEEXT_1 = allocfail$(EXEEXT)
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__EXEEXT_2 = b2test$(EXEEXT)
@HAVE_BUILDID_TRUE@@HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__EXEEXT_3 = b3test$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_4 = test_elf_32$(EXEEXT) test_elf_64$(EXEEXT) \
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__EXEEXT_4 = m2test$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_5 = test_elf_32$(EXEEXT) test_elf_64$(EXEEXT) \
@NATIVE_TRUE@ test_macho$(EXEEXT) test_xcoff_32$(EXEEXT) \
@NATIVE_TRUE@ test_xcoff_64$(EXEEXT) test_pecoff$(EXEEXT) \
@NATIVE_TRUE@ test_unknown$(EXEEXT) unittest$(EXEEXT) \
@NATIVE_TRUE@ unittest_alloc$(EXEEXT) btest$(EXEEXT)
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__EXEEXT_5 = btest_lto$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_6 = btest_alloc$(EXEEXT) stest$(EXEEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__EXEEXT_6 = btest_lto$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_7 = btest_alloc$(EXEEXT) stest$(EXEEXT) \
@NATIVE_TRUE@ stest_alloc$(EXEEXT)
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__EXEEXT_7 = ztest$(EXEEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__EXEEXT_8 = ztest$(EXEEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ ztest_alloc$(EXEEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ zstdtest$(EXEEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ zstdtest_alloc$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_8 = edtest$(EXEEXT) edtest_alloc$(EXEEXT)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_9 = ttest$(EXEEXT) \
@NATIVE_TRUE@am__EXEEXT_9 = edtest$(EXEEXT) edtest_alloc$(EXEEXT)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_10 = ttest$(EXEEXT) \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc$(EXEEXT)
@HAVE_COMPRESSED_DEBUG_ZLIB_GNU_TRUE@@NATIVE_TRUE@am__EXEEXT_10 = ctestg$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZLIB_GNU_TRUE@@NATIVE_TRUE@am__EXEEXT_11 = ctestg$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZLIB_GNU_TRUE@@NATIVE_TRUE@ ctestg_alloc$(EXEEXT)
@HAVE_COMPRESSED_DEBUG_ZLIB_GABI_TRUE@@NATIVE_TRUE@am__EXEEXT_11 = ctesta$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZLIB_GABI_TRUE@@NATIVE_TRUE@am__EXEEXT_12 = ctesta$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZLIB_GABI_TRUE@@NATIVE_TRUE@ ctesta_alloc$(EXEEXT)
@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@am__EXEEXT_12 = ctestzstd$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@am__EXEEXT_13 = ctestzstd$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@ ctestzstd_alloc$(EXEEXT)
@HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__EXEEXT_13 = dwarf5$(EXEEXT) \
@HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__EXEEXT_14 = dwarf5$(EXEEXT) \
@HAVE_DWARF5_TRUE@@NATIVE_TRUE@ dwarf5_alloc$(EXEEXT)
@NATIVE_TRUE@am__EXEEXT_14 = mtest$(EXEEXT)
@HAVE_ELF_TRUE@am__EXEEXT_15 = xztest$(EXEEXT) xztest_alloc$(EXEEXT)
am__EXEEXT_16 = $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
$(am__EXEEXT_10) $(am__EXEEXT_11) $(am__EXEEXT_12) \
$(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15)
@NATIVE_TRUE@am__EXEEXT_15 = mtest$(EXEEXT)
@HAVE_ELF_TRUE@am__EXEEXT_16 = xztest$(EXEEXT) xztest_alloc$(EXEEXT)
am__EXEEXT_17 = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
$(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_10) \
$(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13) \
$(am__EXEEXT_14) $(am__EXEEXT_15) $(am__EXEEXT_16)
@NATIVE_TRUE@am_allocfail_OBJECTS = allocfail-allocfail.$(OBJEXT) \
@NATIVE_TRUE@ allocfail-testlib.$(OBJEXT)
allocfail_OBJECTS = $(am_allocfail_OBJECTS)
@ -383,6 +386,14 @@ edtest_alloc_OBJECTS = $(am_edtest_alloc_OBJECTS)
edtest_alloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(edtest_alloc_CFLAGS) \
$(CFLAGS) $(edtest_alloc_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_TRUE@am__objects_10 = m2test-mtest.$(OBJEXT) \
@NATIVE_TRUE@ m2test-testlib.$(OBJEXT)
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am_m2test_OBJECTS = $(am__objects_10)
m2test_OBJECTS = $(am_m2test_OBJECTS)
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@m2test_DEPENDENCIES = libbacktrace_elf_for_test.la
m2test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(m2test_CFLAGS) $(CFLAGS) \
$(m2test_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_TRUE@am_mtest_OBJECTS = mtest-mtest.$(OBJEXT) \
@NATIVE_TRUE@ mtest-testlib.$(OBJEXT)
mtest_OBJECTS = $(am_mtest_OBJECTS)
@ -396,8 +407,8 @@ stest_OBJECTS = $(am_stest_OBJECTS)
stest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(stest_CFLAGS) $(CFLAGS) \
$(stest_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_TRUE@am__objects_10 = stest_alloc-stest.$(OBJEXT)
@NATIVE_TRUE@am_stest_alloc_OBJECTS = $(am__objects_10)
@NATIVE_TRUE@am__objects_11 = stest_alloc-stest.$(OBJEXT)
@NATIVE_TRUE@am_stest_alloc_OBJECTS = $(am__objects_11)
stest_alloc_OBJECTS = $(am_stest_alloc_OBJECTS)
@NATIVE_TRUE@stest_alloc_DEPENDENCIES = libbacktrace_alloc.la
stest_alloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ -473,11 +484,11 @@ ttest_OBJECTS = $(am_ttest_OBJECTS)
ttest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(ttest_CFLAGS) $(CFLAGS) \
$(ttest_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__objects_11 = \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__objects_12 = \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc-ttest.$(OBJEXT) \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc-testlib.$(OBJEXT)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am_ttest_alloc_OBJECTS = \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ $(am__objects_11)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ $(am__objects_12)
ttest_alloc_OBJECTS = $(am_ttest_alloc_OBJECTS)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_alloc_DEPENDENCIES = \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ libbacktrace_alloc.la
@ -491,9 +502,9 @@ unittest_OBJECTS = $(am_unittest_OBJECTS)
unittest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(unittest_CFLAGS) \
$(CFLAGS) $(unittest_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_TRUE@am__objects_12 = unittest_alloc-unittest.$(OBJEXT) \
@NATIVE_TRUE@am__objects_13 = unittest_alloc-unittest.$(OBJEXT) \
@NATIVE_TRUE@ unittest_alloc-testlib.$(OBJEXT)
@NATIVE_TRUE@am_unittest_alloc_OBJECTS = $(am__objects_12)
@NATIVE_TRUE@am_unittest_alloc_OBJECTS = $(am__objects_13)
unittest_alloc_OBJECTS = $(am_unittest_alloc_OBJECTS)
@NATIVE_TRUE@unittest_alloc_DEPENDENCIES = libbacktrace_alloc.la
unittest_alloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@ -508,9 +519,9 @@ xztest_OBJECTS = $(am_xztest_OBJECTS)
xztest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(xztest_CFLAGS) $(CFLAGS) \
$(xztest_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_ELF_TRUE@am__objects_13 = xztest_alloc-xztest.$(OBJEXT) \
@HAVE_ELF_TRUE@am__objects_14 = xztest_alloc-xztest.$(OBJEXT) \
@HAVE_ELF_TRUE@ xztest_alloc-testlib.$(OBJEXT)
@HAVE_ELF_TRUE@am_xztest_alloc_OBJECTS = $(am__objects_13)
@HAVE_ELF_TRUE@am_xztest_alloc_OBJECTS = $(am__objects_14)
xztest_alloc_OBJECTS = $(am_xztest_alloc_OBJECTS)
@HAVE_ELF_TRUE@xztest_alloc_DEPENDENCIES = libbacktrace_alloc.la \
@HAVE_ELF_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
@ -527,11 +538,11 @@ zstdtest_OBJECTS = $(am_zstdtest_OBJECTS)
zstdtest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(zstdtest_CFLAGS) \
$(CFLAGS) $(zstdtest_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__objects_14 = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__objects_15 = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ zstdtest_alloc-zstdtest.$(OBJEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ zstdtest_alloc-testlib.$(OBJEXT)
@HAVE_ELF_TRUE@@NATIVE_TRUE@am_zstdtest_alloc_OBJECTS = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__objects_14)
@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__objects_15)
zstdtest_alloc_OBJECTS = $(am_zstdtest_alloc_OBJECTS)
@HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_alloc_DEPENDENCIES = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ libbacktrace_alloc.la \
@ -550,11 +561,11 @@ ztest_OBJECTS = $(am_ztest_OBJECTS)
ztest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(ztest_CFLAGS) $(CFLAGS) \
$(ztest_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__objects_15 = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@am__objects_16 = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ ztest_alloc-ztest.$(OBJEXT) \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ ztest_alloc-testlib.$(OBJEXT)
@HAVE_ELF_TRUE@@NATIVE_TRUE@am_ztest_alloc_OBJECTS = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__objects_15)
@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__objects_16)
ztest_alloc_OBJECTS = $(am_ztest_alloc_OBJECTS)
@HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_alloc_DEPENDENCIES = \
@HAVE_ELF_TRUE@@NATIVE_TRUE@ libbacktrace_alloc.la \
@ -607,8 +618,8 @@ SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \
$(ctestg_alloc_SOURCES) $(ctestzstd_SOURCES) \
$(ctestzstd_alloc_SOURCES) $(dwarf5_SOURCES) \
$(dwarf5_alloc_SOURCES) $(edtest_SOURCES) \
$(edtest_alloc_SOURCES) $(mtest_SOURCES) $(stest_SOURCES) \
$(stest_alloc_SOURCES) $(test_elf_32_SOURCES) \
$(edtest_alloc_SOURCES) $(m2test_SOURCES) $(mtest_SOURCES) \
$(stest_SOURCES) $(stest_alloc_SOURCES) $(test_elf_32_SOURCES) \
$(test_elf_64_SOURCES) $(test_macho_SOURCES) \
$(test_pecoff_SOURCES) $(test_unknown_SOURCES) \
$(test_xcoff_32_SOURCES) $(test_xcoff_64_SOURCES) \
@ -1034,14 +1045,15 @@ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
# Add a test to this variable if you want it to be built as a Makefile
# target and run.
MAKETESTS = $(am__append_7) $(am__append_9) $(am__append_12) \
$(am__append_13) $(am__append_22) $(am__append_30)
$(am__append_13) $(am__append_22) $(am__append_30) \
$(am__append_32)
# Add a test to this variable if you want it to be built as a program,
# with SOURCES, etc., and run.
BUILDTESTS = $(am__append_2) $(am__append_10) $(am__append_11) \
$(am__append_16) $(am__append_19) $(am__append_20) \
$(am__append_23) $(am__append_24) $(am__append_25) \
$(am__append_26) $(am__append_28) $(am__append_33)
$(am__append_26) $(am__append_28) $(am__append_35)
# Add a file to this variable if you want it to be built for testing.
check_DATA = $(am__append_5) $(am__append_21) $(am__append_27) \
@ -1218,20 +1230,25 @@ libbacktrace_testing_ldflags = -no-install
@NATIVE_TRUE@mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
@NATIVE_TRUE@mtest_LDFLAGS = $(libbacktrace_testing_ldflags)
@NATIVE_TRUE@mtest_LDADD = libbacktrace.la
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@m2test_SOURCES = $(mtest_SOURCES)
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@m2test_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@m2test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags)
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@m2test_LDADD = libbacktrace_elf_for_test.la
@HAVE_ELF_TRUE@xztest_SOURCES = xztest.c testlib.c
@HAVE_ELF_TRUE@xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
@HAVE_ELF_TRUE@xztest_LDFLAGS = $(libbacktrace_testing_ldflags)
@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_31) \
@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_33) \
@HAVE_ELF_TRUE@ $(CLOCK_GETTIME_LINK)
@HAVE_ELF_TRUE@xztest_alloc_SOURCES = $(xztest_SOURCES)
@HAVE_ELF_TRUE@xztest_alloc_CFLAGS = $(xztest_CFLAGS)
@HAVE_ELF_TRUE@xztest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
@HAVE_ELF_TRUE@xztest_alloc_LDADD = libbacktrace_alloc.la \
@HAVE_ELF_TRUE@ $(am__append_32) $(CLOCK_GETTIME_LINK)
@HAVE_ELF_TRUE@ $(am__append_34) $(CLOCK_GETTIME_LINK)
CLEANFILES = \
$(MAKETESTS) $(BUILDTESTS) *.debug elf_for_test.c edtest2_build.c \
gen_edtest2_build \
*.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip
*.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip \
*.dsyms2 *.fsyms2 *.keepsyms2 *.dbg2 *.mdbg2 *.mdbg2.xz *.strip2
# We can't use automake's automatic dependency tracking, because it
@ -1421,6 +1438,10 @@ edtest_alloc$(EXEEXT): $(edtest_alloc_OBJECTS) $(edtest_alloc_DEPENDENCIES) $(EX
@rm -f edtest_alloc$(EXEEXT)
$(AM_V_CCLD)$(edtest_alloc_LINK) $(edtest_alloc_OBJECTS) $(edtest_alloc_LDADD) $(LIBS)
m2test$(EXEEXT): $(m2test_OBJECTS) $(m2test_DEPENDENCIES) $(EXTRA_m2test_DEPENDENCIES)
@rm -f m2test$(EXEEXT)
$(AM_V_CCLD)$(m2test_LINK) $(m2test_OBJECTS) $(m2test_LDADD) $(LIBS)
mtest$(EXEEXT): $(mtest_OBJECTS) $(mtest_DEPENDENCIES) $(EXTRA_mtest_DEPENDENCIES)
@rm -f mtest$(EXEEXT)
$(AM_V_CCLD)$(mtest_LINK) $(mtest_OBJECTS) $(mtest_LDADD) $(LIBS)
@ -1720,6 +1741,18 @@ edtest_alloc-testlib.o: testlib.c
edtest_alloc-testlib.obj: testlib.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(edtest_alloc_CFLAGS) $(CFLAGS) -c -o edtest_alloc-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
m2test-mtest.o: mtest.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(m2test_CFLAGS) $(CFLAGS) -c -o m2test-mtest.o `test -f 'mtest.c' || echo '$(srcdir)/'`mtest.c
m2test-mtest.obj: mtest.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(m2test_CFLAGS) $(CFLAGS) -c -o m2test-mtest.obj `if test -f 'mtest.c'; then $(CYGPATH_W) 'mtest.c'; else $(CYGPATH_W) '$(srcdir)/mtest.c'; fi`
m2test-testlib.o: testlib.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(m2test_CFLAGS) $(CFLAGS) -c -o m2test-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
m2test-testlib.obj: testlib.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(m2test_CFLAGS) $(CFLAGS) -c -o m2test-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
mtest-mtest.o: mtest.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtest_CFLAGS) $(CFLAGS) -c -o mtest-mtest.o `test -f 'mtest.c' || echo '$(srcdir)/'`mtest.c
@ -2227,6 +2260,13 @@ mtest_minidebug.log: mtest_minidebug
--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)
m2test_minidebug2.log: m2test_minidebug2
@p='m2test_minidebug2'; \
b='m2test_minidebug2'; \
$(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)
test_elf_32.log: test_elf_32$(EXEEXT)
@p='test_elf_32$(EXEEXT)'; \
b='test_elf_32'; \
@ -2692,6 +2732,23 @@ uninstall-am:
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg.xz $<.strip
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ mv $<.strip $@
# minidebug2 is like minidebug but also adds the gnu_debugdata section
# to the debug file, and uses a build ID file. There is no reason to do
# this but it was causing an infinite recursion.
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@%_minidebug2: %
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(COMM) -13 $<.dsyms2 $<.fsyms2 > $<.keepsyms2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --only-keep-debug $< $<.dbg2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms2 $<.dbg2 $<.mdbg2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ rm -f $<.mdbg2.xz
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(XZ) $<.mdbg2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.dbg2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.strip2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(SHELL) ./install-debuginfo-for-buildid.sh $(TEST_BUILD_ID_DIR) $<.dbg2
@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_MINIDEBUG_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ mv $<.strip2 $@
clean-local:
-rm -rf usr
alloc.lo: config.h backtrace.h internal.h

View File

@ -6841,7 +6841,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
}
}
if (!gnu_debugdata_view_valid
if (!debuginfo
&& !gnu_debugdata_view_valid
&& strcmp (name, ".gnu_debugdata") == 0)
{
if (!elf_get_view (state, descriptor, memory, memory_size,