Browse Source

Update from gcc trunk version of libbacktrace at svn rev 256427. (#8)

Includes (among other things) support for compressed debug sections,
a variety of bugfixes, and expanded test coverage.
lib
Than McIntosh 4 years ago
committed by Ian Lance Taylor
parent
commit
17f687d2b9
  1. 76
      Makefile.am
  2. 288
      Makefile.in
  3. 1
      acinclude.m4
  4. 1217
      aclocal.m4
  5. 2
      alloc.c
  6. 2
      atomic.c
  7. 2
      backtrace.c
  8. 2
      backtrace.h
  9. 281
      btest.c
  10. 3024
      configure
  11. 98
      configure.ac
  12. 27
      dwarf.c
  13. 121
      edtest.c
  14. 43
      edtest2.c
  15. 2588
      elf.c
  16. 17
      fileline.c
  17. 49
      filenames.h
  18. 12
      internal.h
  19. 1806
      ltmain.sh
  20. 2
      mmap.c
  21. 2
      mmapio.c
  22. 83
      move-if-change
  23. 2
      nounwind.c
  24. 7
      pecoff.c
  25. 2
      posix.c
  26. 2
      print.c
  27. 2
      read.c
  28. 2
      simple.c
  29. 2
      sort.c
  30. 2
      state.c
  31. 2
      stest.c
  32. 234
      testlib.c
  33. 110
      testlib.h
  34. 161
      ttest.c
  35. 3
      unknown.c
  36. 1608
      xcoff.c
  37. 474
      ztest.c

76
Makefile.am

@ -1,5 +1,5 @@
# Makefile.am -- Backtrace Makefile.
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@ -29,11 +29,14 @@
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
lib_LTLIBRARIES = libbacktrace.la
include_HEADERS = backtrace.h backtrace-supported.h
noinst_LTLIBRARIES = libbacktrace.la
libbacktrace_la_SOURCES = \
backtrace.h \
atomic.c \
@ -53,7 +56,8 @@ BACKTRACE_FILES = \
FORMAT_FILES = \
elf.c \
pecoff.c \
unknown.c
unknown.c \
xcoff.c
VIEW_FILES = \
read.c \
@ -85,7 +89,7 @@ TESTS = $(check_PROGRAMS)
if NATIVE
btest_SOURCES = btest.c
btest_SOURCES = btest.c testlib.c
btest_CFLAGS = $(AM_CFLAGS) -g -O
btest_LDADD = libbacktrace.la
@ -96,6 +100,64 @@ stest_LDADD = libbacktrace.la
check_PROGRAMS += stest
ztest_SOURCES = ztest.c testlib.c
ztest_CFLAGS = -DSRCDIR=\"$(srcdir)\"
ztest_LDADD = libbacktrace.la
if HAVE_ZLIB
ztest_LDADD += -lz
endif
ztest_LDADD += $(CLOCK_GETTIME_LINK)
check_PROGRAMS += ztest
edtest_SOURCES = edtest.c edtest2_build.c testlib.c
edtest_LDADD = libbacktrace.la
check_PROGRAMS += edtest
edtest2_build.c: gen_edtest2_build; @true
gen_edtest2_build: $(srcdir)/edtest2.c
cat $(srcdir)/edtest2.c > tmp-edtest2_build.c
$(SHELL) $(srcdir)/move-if-change tmp-edtest2_build.c edtest2_build.c
echo timestamp > $@
if HAVE_PTHREAD
check_PROGRAMS += ttest
ttest_SOURCES = ttest.c testlib.c
ttest_CFLAGS = $(AM_CFLAGS) -pthread
ttest_LDADD = libbacktrace.la
endif HAVE_PTHREAD
if HAVE_OBJCOPY_DEBUGLINK
TESTS += dtest
dtest: btest
$(OBJCOPY) --only-keep-debug btest btest.debug
$(OBJCOPY) --strip-debug --add-gnu-debuglink=btest.debug btest dtest
endif HAVE_OBJCOPY_DEBUGLINK
if HAVE_COMPRESSED_DEBUG
ctestg_SOURCES = btest.c testlib.c
ctestg_CFLAGS = $(AM_CFLAGS) -g
ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu
ctestg_LDADD = libbacktrace.la
ctesta_SOURCES = btest.c testlib.c
ctesta_CFLAGS = $(AM_CFLAGS) -g
ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi
ctesta_LDADD = libbacktrace.la
check_PROGRAMS += ctestg ctesta
endif
endif NATIVE
# We can't use automake's automatic dependency tracking, because it
@ -112,8 +174,8 @@ endif NATIVE
alloc.lo: config.h backtrace.h internal.h
backtrace.lo: config.h backtrace.h internal.h
btest.lo: backtrace.h backtrace-supported.h
dwarf.lo: config.h backtrace.h internal.h
btest.lo: backtrace.h backtrace-supported.h filenames.h
dwarf.lo: config.h filenames.h backtrace.h internal.h
elf.lo: config.h backtrace.h internal.h
fileline.lo: config.h backtrace.h internal.h
mmap.lo: config.h backtrace.h internal.h
@ -128,3 +190,5 @@ sort.lo: config.h backtrace.h internal.h
stest.lo: config.h backtrace.h internal.h
state.lo: config.h backtrace.h backtrace-supported.h internal.h
unknown.lo: config.h backtrace.h internal.h
xcoff.lo: config.h backtrace.h internal.h

288
Makefile.in

@ -16,7 +16,7 @@
@SET_MAKE@
# Makefile.am -- Backtrace Makefile.
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@ -84,8 +84,12 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = $(am__EXEEXT_1)
@NATIVE_TRUE@am__append_1 = btest stest
check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
@NATIVE_TRUE@am__append_1 = btest stest ztest edtest
@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_2 = -lz
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_3 = ttest
@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_4 = dtest
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_5 = ctestg ctesta
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
@ -102,49 +106,63 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = backtrace-supported.h
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
am_libbacktrace_la_OBJECTS = atomic.lo dwarf.lo fileline.lo posix.lo \
print.lo sort.lo state.lo
libbacktrace_la_OBJECTS = $(am_libbacktrace_la_OBJECTS)
@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT)
@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT)
@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT) \
@NATIVE_TRUE@ ztest$(EXEEXT) edtest$(EXEEXT)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_2 = ttest$(EXEEXT)
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__EXEEXT_3 = \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctestg$(EXEEXT) \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta$(EXEEXT)
@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT) \
@NATIVE_TRUE@ btest-testlib.$(OBJEXT)
btest_OBJECTS = $(am_btest_OBJECTS)
@NATIVE_TRUE@btest_DEPENDENCIES = libbacktrace.la
btest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(btest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am_ctesta_OBJECTS = ctesta-btest.$(OBJEXT) \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta-testlib.$(OBJEXT)
ctesta_OBJECTS = $(am_ctesta_OBJECTS)
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_DEPENDENCIES = \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ libbacktrace.la
ctesta_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(ctesta_CFLAGS) $(CFLAGS) \
$(ctesta_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am_ctestg_OBJECTS = ctestg-btest.$(OBJEXT) \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctestg-testlib.$(OBJEXT)
ctestg_OBJECTS = $(am_ctestg_OBJECTS)
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_DEPENDENCIES = \
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ libbacktrace.la
ctestg_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(ctestg_CFLAGS) $(CFLAGS) \
$(ctestg_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_TRUE@am_edtest_OBJECTS = edtest.$(OBJEXT) \
@NATIVE_TRUE@ edtest2_build.$(OBJEXT) testlib.$(OBJEXT)
edtest_OBJECTS = $(am_edtest_OBJECTS)
@NATIVE_TRUE@edtest_DEPENDENCIES = libbacktrace.la
@NATIVE_TRUE@am_stest_OBJECTS = stest.$(OBJEXT)
stest_OBJECTS = $(am_stest_OBJECTS)
@NATIVE_TRUE@stest_DEPENDENCIES = libbacktrace.la
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am_ttest_OBJECTS = \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest-ttest.$(OBJEXT) \
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest-testlib.$(OBJEXT)
ttest_OBJECTS = $(am_ttest_OBJECTS)
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_DEPENDENCIES = libbacktrace.la
ttest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(ttest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
@NATIVE_TRUE@am_ztest_OBJECTS = ztest-ztest.$(OBJEXT) \
@NATIVE_TRUE@ ztest-testlib.$(OBJEXT)
ztest_OBJECTS = $(am_ztest_OBJECTS)
@NATIVE_TRUE@ztest_DEPENDENCIES = libbacktrace.la \
@NATIVE_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
ztest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(ztest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp =
am__depfiles_maybe =
@ -158,7 +176,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \
$(btest_SOURCES) $(stest_SOURCES)
$(btest_SOURCES) $(ctesta_SOURCES) $(ctestg_SOURCES) \
$(edtest_SOURCES) $(stest_SOURCES) $(ttest_SOURCES) \
$(ztest_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@ -170,6 +190,34 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
@ -190,6 +238,7 @@ BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@
BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@
CC = @CC@
CFLAGS = @CFLAGS@
CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -223,6 +272,8 @@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJCOPY = @OBJCOPY@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
@ -235,6 +286,7 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PIC_FLAG = @PIC_FLAG@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@ -278,7 +330,6 @@ libexecdir = @libexecdir@
libtool_VERSION = @libtool_VERSION@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@ -287,6 +338,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -299,9 +351,10 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
lib_LTLIBRARIES = libbacktrace.la
include_HEADERS = backtrace.h backtrace-supported.h
noinst_LTLIBRARIES = libbacktrace.la
libbacktrace_la_SOURCES = \
backtrace.h \
atomic.c \
@ -321,7 +374,8 @@ BACKTRACE_FILES = \
FORMAT_FILES = \
elf.c \
pecoff.c \
unknown.c
unknown.c \
xcoff.c
VIEW_FILES = \
read.c \
@ -344,12 +398,29 @@ libbacktrace_la_LIBADD = \
$(ALLOC_FILE)
libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
TESTS = $(check_PROGRAMS)
@NATIVE_TRUE@btest_SOURCES = btest.c
TESTS = $(check_PROGRAMS) $(am__append_4)
@NATIVE_TRUE@btest_SOURCES = btest.c testlib.c
@NATIVE_TRUE@btest_CFLAGS = $(AM_CFLAGS) -g -O
@NATIVE_TRUE@btest_LDADD = libbacktrace.la
@NATIVE_TRUE@stest_SOURCES = stest.c
@NATIVE_TRUE@stest_LDADD = libbacktrace.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@ $(CLOCK_GETTIME_LINK)
@NATIVE_TRUE@edtest_SOURCES = edtest.c edtest2_build.c testlib.c
@NATIVE_TRUE@edtest_LDADD = libbacktrace.la
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_SOURCES = ttest.c testlib.c
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_CFLAGS = $(AM_CFLAGS) -pthread
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_LDADD = libbacktrace.la
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_SOURCES = btest.c testlib.c
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_CFLAGS = $(AM_CFLAGS) -g
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctestg_LDADD = libbacktrace.la
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_SOURCES = btest.c testlib.c
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_CFLAGS = $(AM_CFLAGS) -g
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi
@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta_LDADD = libbacktrace.la
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@ -406,40 +477,17 @@ distclean-hdr:
-rm -f config.h stamp-h1
backtrace-supported.h: $(top_builddir)/config.status $(srcdir)/backtrace-supported.h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(EXTRA_libbacktrace_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
$(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@ -452,9 +500,24 @@ clean-checkPROGRAMS:
btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) $(EXTRA_btest_DEPENDENCIES)
@rm -f btest$(EXEEXT)
$(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS)
ctesta$(EXEEXT): $(ctesta_OBJECTS) $(ctesta_DEPENDENCIES) $(EXTRA_ctesta_DEPENDENCIES)
@rm -f ctesta$(EXEEXT)
$(ctesta_LINK) $(ctesta_OBJECTS) $(ctesta_LDADD) $(LIBS)
ctestg$(EXEEXT): $(ctestg_OBJECTS) $(ctestg_DEPENDENCIES) $(EXTRA_ctestg_DEPENDENCIES)
@rm -f ctestg$(EXEEXT)
$(ctestg_LINK) $(ctestg_OBJECTS) $(ctestg_LDADD) $(LIBS)
edtest$(EXEEXT): $(edtest_OBJECTS) $(edtest_DEPENDENCIES) $(EXTRA_edtest_DEPENDENCIES)
@rm -f edtest$(EXEEXT)
$(LINK) $(edtest_OBJECTS) $(edtest_LDADD) $(LIBS)
stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) $(EXTRA_stest_DEPENDENCIES)
@rm -f stest$(EXEEXT)
$(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
ttest$(EXEEXT): $(ttest_OBJECTS) $(ttest_DEPENDENCIES) $(EXTRA_ttest_DEPENDENCIES)
@rm -f ttest$(EXEEXT)
$(ttest_LINK) $(ttest_OBJECTS) $(ttest_LDADD) $(LIBS)
ztest$(EXEEXT): $(ztest_OBJECTS) $(ztest_DEPENDENCIES) $(EXTRA_ztest_DEPENDENCIES)
@rm -f ztest$(EXEEXT)
$(ztest_LINK) $(ztest_OBJECTS) $(ztest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -477,6 +540,60 @@ btest-btest.o: btest.c
btest-btest.obj: btest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi`
btest-testlib.o: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
btest-testlib.obj: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
ctesta-btest.o: btest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctesta_CFLAGS) $(CFLAGS) -c -o ctesta-btest.o `test -f 'btest.c' || echo '$(srcdir)/'`btest.c
ctesta-btest.obj: btest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctesta_CFLAGS) $(CFLAGS) -c -o ctesta-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi`
ctesta-testlib.o: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctesta_CFLAGS) $(CFLAGS) -c -o ctesta-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
ctesta-testlib.obj: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctesta_CFLAGS) $(CFLAGS) -c -o ctesta-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
ctestg-btest.o: btest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctestg_CFLAGS) $(CFLAGS) -c -o ctestg-btest.o `test -f 'btest.c' || echo '$(srcdir)/'`btest.c
ctestg-btest.obj: btest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctestg_CFLAGS) $(CFLAGS) -c -o ctestg-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi`
ctestg-testlib.o: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctestg_CFLAGS) $(CFLAGS) -c -o ctestg-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
ctestg-testlib.obj: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ctestg_CFLAGS) $(CFLAGS) -c -o ctestg-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
ttest-ttest.o: ttest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ttest_CFLAGS) $(CFLAGS) -c -o ttest-ttest.o `test -f 'ttest.c' || echo '$(srcdir)/'`ttest.c
ttest-ttest.obj: ttest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ttest_CFLAGS) $(CFLAGS) -c -o ttest-ttest.obj `if test -f 'ttest.c'; then $(CYGPATH_W) 'ttest.c'; else $(CYGPATH_W) '$(srcdir)/ttest.c'; fi`
ttest-testlib.o: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ttest_CFLAGS) $(CFLAGS) -c -o ttest-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
ttest-testlib.obj: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ttest_CFLAGS) $(CFLAGS) -c -o ttest-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
ztest-ztest.o: ztest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ztest_CFLAGS) $(CFLAGS) -c -o ztest-ztest.o `test -f 'ztest.c' || echo '$(srcdir)/'`ztest.c
ztest-ztest.obj: ztest.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ztest_CFLAGS) $(CFLAGS) -c -o ztest-ztest.obj `if test -f 'ztest.c'; then $(CYGPATH_W) 'ztest.c'; else $(CYGPATH_W) '$(srcdir)/ztest.c'; fi`
ztest-testlib.o: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ztest_CFLAGS) $(CFLAGS) -c -o ztest-testlib.o `test -f 'testlib.c' || echo '$(srcdir)/'`testlib.c
ztest-testlib.obj: testlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ztest_CFLAGS) $(CFLAGS) -c -o ztest-testlib.obj `if test -f 'testlib.c'; then $(CYGPATH_W) 'testlib.c'; else $(CYGPATH_W) '$(srcdir)/testlib.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
@ -674,7 +791,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) config.h
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
for dir in "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@ -709,8 +826,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean-multi
clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
clean-libtool mostlyclean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am distclean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@ -736,7 +853,7 @@ install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES install-multi
install-exec-am: install-multi
install-html: install-html-am
@ -777,29 +894,39 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
uninstall-am: uninstall-includeHEADERS
.MAKE: all all-multi check-am clean-multi distclean-multi install-am \
install-multi install-strip maintainer-clean-multi \
mostlyclean-multi
.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-TESTS \
check-am clean clean-checkPROGRAMS clean-generic \
clean-libLTLIBRARIES clean-libtool clean-multi ctags distclean \
check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
clean-multi clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-multi distclean-tags dvi dvi-am \
html html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-multi install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
install-man install-multi install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic maintainer-clean-multi mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
mostlyclean-multi pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-includeHEADERS uninstall-libLTLIBRARIES
uninstall-am uninstall-includeHEADERS
@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
@NATIVE_TRUE@ $(SHELL) $(srcdir)/move-if-change tmp-edtest2_build.c edtest2_build.c
@NATIVE_TRUE@ echo timestamp > $@
@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@dtest: btest
@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --only-keep-debug btest btest.debug
@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --strip-debug --add-gnu-debuglink=btest.debug btest dtest
# We can't use automake's automatic dependency tracking, because it
# breaks when using bootstrap-lean. Automatic dependency tracking
@ -815,8 +942,8 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
alloc.lo: config.h backtrace.h internal.h
backtrace.lo: config.h backtrace.h internal.h
btest.lo: backtrace.h backtrace-supported.h
dwarf.lo: config.h backtrace.h internal.h
btest.lo: backtrace.h backtrace-supported.h filenames.h
dwarf.lo: config.h filenames.h backtrace.h internal.h
elf.lo: config.h backtrace.h internal.h
fileline.lo: config.h backtrace.h internal.h
mmap.lo: config.h backtrace.h internal.h
@ -831,6 +958,7 @@ sort.lo: config.h backtrace.h internal.h
stest.lo: config.h backtrace.h internal.h
state.lo: config.h backtrace.h backtrace-supported.h internal.h
unknown.lo: config.h backtrace.h internal.h
xcoff.lo: config.h backtrace.h internal.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

1
acinclude.m4

@ -69,3 +69,4 @@ CFLAGS="$save_CFLAGS"
m4_popdef([acx_Var])dnl
AC_LANG_POP(C)
])# ACX_PROG_CC_WARNING_OPTS

1217
aclocal.m4
File diff suppressed because it is too large
View File

2
alloc.c

@ -1,5 +1,5 @@
/* alloc.c -- Memory allocation without mmap.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without

2
atomic.c

@ -1,5 +1,5 @@
/* atomic.c -- Support for atomic functions if not present.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
Copyright (C) 2013-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without

2
backtrace.c

@ -1,5 +1,5 @@
/* backtrace.c -- Entry point for stack backtrace library.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without

2
backtrace.h

@ -1,5 +1,5 @@
/* backtrace.h -- Public header file for stack backtrace library.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without

281
btest.c

@ -1,5 +1,5 @@
/* btest.c -- Test for libbacktrace library
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
@ -38,246 +38,12 @@ POSSIBILITY OF SUCH DAMAGE. */
#include <stdlib.h>
#include <string.h>
#include "filenames.h"
#include "backtrace.h"
#include "backtrace-supported.h"
/* Portable attribute syntax. Actually some of these tests probably
won't work if the attributes are not recognized. */
#ifndef GCC_VERSION
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#endif
#if (GCC_VERSION < 2007)
# define __attribute__(x)
#endif
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
# define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
#else
# define IS_DIR_SEPARATOR(c) ((c) == '/')
#endif
/* Used to collect backtrace info. */
struct info
{
char *filename;
int lineno;
char *function;
};
/* Passed to backtrace callback function. */
struct bdata
{
struct info *all;
size_t index;
size_t max;
int failed;
};
/* Passed to backtrace_simple callback function. */
struct sdata
{
uintptr_t *addrs;
size_t index;
size_t max;
int failed;
};
/* Passed to backtrace_syminfo callback function. */
struct symdata
{
const char *name;
uintptr_t val, size;
int failed;
};
/* The backtrace state. */
static void *state;
/* The number of failures. */
static int failures;
/* Return the base name in a path. */
static const char *
base (const char *p)
{
const char *last;
const char *s;
last = NULL;
for (s = p; *s != '\0'; ++s)
{
if (IS_DIR_SEPARATOR (*s))
last = s + 1;
}
return last != NULL ? last : p;
}
/* Check an entry in a struct info array. */
static void
check (const char *name, int index, const struct info *all, int want_lineno,
const char *want_function, int *failed)
{
if (*failed)
return;
if (all[index].filename == NULL || all[index].function == NULL)
{
fprintf (stderr, "%s: [%d]: missing file name or function name\n",
name, index);
*failed = 1;
return;
}
if (strcmp (base (all[index].filename), "btest.c") != 0)
{
fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index,
all[index].filename);
*failed = 1;
}
if (all[index].lineno != want_lineno)
{
fprintf (stderr, "%s: [%d]: got %d expected %d\n", name, index,
all[index].lineno, want_lineno);
*failed = 1;
}
if (strcmp (all[index].function, want_function) != 0)
{
fprintf (stderr, "%s: [%d]: got %s expected %s\n", name, index,
all[index].function, want_function);
*failed = 1;
}
}
/* The backtrace callback function. */
static int
callback_one (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
const char *filename, int lineno, const char *function)
{
struct bdata *data = (struct bdata *) vdata;
struct info *p;
if (data->index >= data->max)
{
fprintf (stderr, "callback_one: callback called too many times\n");
data->failed = 1;
return 1;
}
p = &data->all[data->index];
if (filename == NULL)
p->filename = NULL;
else
{
p->filename = strdup (filename);
assert (p->filename != NULL);
}
p->lineno = lineno;
if (function == NULL)
p->function = NULL;
else
{
p->function = strdup (function);
assert (p->function != NULL);
}
++data->index;
return 0;
}
/* An error callback passed to backtrace. */
static void
error_callback_one (void *vdata, const char *msg, int errnum)
{
struct bdata *data = (struct bdata *) vdata;
fprintf (stderr, "%s", msg);
if (errnum > 0)
fprintf (stderr, ": %s", strerror (errnum));
fprintf (stderr, "\n");
data->failed = 1;
}
/* The backtrace_simple callback function. */
static int
callback_two (void *vdata, uintptr_t pc)
{
struct sdata *data = (struct sdata *) vdata;
if (data->index >= data->max)
{
fprintf (stderr, "callback_two: callback called too many times\n");
data->failed = 1;
return 1;
}
data->addrs[data->index] = pc;
++data->index;
return 0;
}
/* An error callback passed to backtrace_simple. */
static void
error_callback_two (void *vdata, const char *msg, int errnum)
{
struct sdata *data = (struct sdata *) vdata;
fprintf (stderr, "%s", msg);
if (errnum > 0)
fprintf (stderr, ": %s", strerror (errnum));
fprintf (stderr, "\n");
data->failed = 1;
}
/* The backtrace_syminfo callback function. */
static void
callback_three (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
const char *symname, uintptr_t symval,
uintptr_t symsize)
{
struct symdata *data = (struct symdata *) vdata;
if (symname == NULL)
data->name = NULL;
else
{
data->name = strdup (symname);
assert (data->name != NULL);
}
data->val = symval;
data->size = symsize;
}
/* The backtrace_syminfo error callback function. */
static void
error_callback_three (void *vdata, const char *msg, int errnum)
{
struct symdata *data = (struct symdata *) vdata;
fprintf (stderr, "%s", msg);
if (errnum > 0)
fprintf (stderr, ": %s", strerror (errnum));
fprintf (stderr, "\n");
data->failed = 1;
}
#include "testlib.h"
/* Test the backtrace function with non-inlined functions. */
@ -329,9 +95,9 @@ f3 (int f1line, int f2line)
data.failed = 1;
}
check ("test1", 0, all, f3line, "f3", &data.failed);
check ("test1", 1, all, f2line, "f2", &data.failed);
check ("test1", 2, all, f1line, "test1", &data.failed);
check ("test1", 0, all, f3line, "f3", "btest.c", &data.failed);
check ("test1", 1, all, f2line, "f2", "btest.c", &data.failed);
check ("test1", 2, all, f1line, "test1", "btest.c", &data.failed);
printf ("%s: backtrace_full noinline\n", data.failed ? "FAIL" : "PASS");
@ -381,9 +147,9 @@ f13 (int f1line, int f2line)
data.failed = 1;
}
check ("test2", 0, all, f3line, "f13", &data.failed);
check ("test2", 1, all, f2line, "f12", &data.failed);
check ("test2", 2, all, f1line, "test2", &data.failed);
check ("test2", 0, all, f3line, "f13", "btest.c", &data.failed);
check ("test2", 1, all, f2line, "f12", "btest.c", &data.failed);
check ("test2", 2, all, f1line, "test2", "btest.c", &data.failed);
printf ("%s: backtrace_full inline\n", data.failed ? "FAIL" : "PASS");
@ -466,9 +232,9 @@ f23 (int f1line, int f2line)
}
}
check ("test3", 0, all, f3line, "f23", &bdata.failed);
check ("test3", 1, all, f2line, "f22", &bdata.failed);
check ("test3", 2, all, f1line, "test3", &bdata.failed);
check ("test3", 0, all, f3line, "f23", "btest.c", &bdata.failed);
check ("test3", 1, all, f2line, "f22", "btest.c", &bdata.failed);
check ("test3", 2, all, f1line, "test3", "btest.c", &bdata.failed);
if (bdata.failed)
data.failed = 1;
@ -604,9 +370,9 @@ f33 (int f1line, int f2line)
bdata.failed = 1;
}
check ("test4", 0, all, f3line, "f33", &bdata.failed);
check ("test4", 1, all, f2line, "f32", &bdata.failed);
check ("test4", 2, all, f1line, "test4", &bdata.failed);
check ("test4", 0, all, f3line, "f33", "btest.c", &bdata.failed);
check ("test4", 1, all, f2line, "f32", "btest.c", &bdata.failed);
check ("test4", 2, all, f1line, "test4", "btest.c", &bdata.failed);
if (bdata.failed)
data.failed = 1;
@ -620,7 +386,7 @@ f33 (int f1line, int f2line)
return failures;
}
#if BACKTRACE_SUPPORTS_DATA
static int test5 (void) __attribute__ ((unused));
int global = 1;
@ -690,19 +456,6 @@ test5 (void)
return failures;
}
#endif /* BACKTRACE_SUPPORTS_DATA */
static void
error_callback_create (void *data ATTRIBUTE_UNUSED, const char *msg,
int errnum)
{
fprintf (stderr, "%s", msg);
if (errnum > 0)
fprintf (stderr, ": %s", strerror (errnum));
fprintf (stderr, "\n");
exit (EXIT_FAILURE);
}
/* Run all the tests. */
int

3024
configure
File diff suppressed because it is too large
View File

98
configure.ac

@ -1,5 +1,5 @@
# configure.ac -- Backtrace configure script.
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@ -83,6 +83,8 @@ esac
LT_INIT
AM_PROG_LIBTOOL
AC_SYS_LARGEFILE
backtrace_supported=yes
if test -n "${with_target_subdir}"; then
@ -232,6 +234,9 @@ elf*) FORMAT_FILE="elf.lo" ;;
pecoff) FORMAT_FILE="pecoff.lo"
backtrace_supports_data=no
;;
xcoff*) FORMAT_FILE="xcoff.lo"
backtrace_supports_data=no
;;
*) AC_MSG_WARN([could not determine output file type])
FORMAT_FILE="unknown.lo"
backtrace_supported=no
@ -248,6 +253,15 @@ elf64) elfsize=64 ;;
esac
AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
# XCOFF defines.
xcoffsize=
case "$libbacktrace_cv_sys_filetype" in
xcoff32) xcoffsize=32 ;;
xcoff64) xcoffsize=64 ;;
*) xcoffsize=unused
esac
AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
BACKTRACE_SUPPORTED=0
if test "$backtrace_supported" = "yes"; then
BACKTRACE_SUPPORTED=1
@ -324,6 +338,24 @@ if test "$have_dl_iterate_phdr" = "yes"; then
AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
fi
# Check for loadquery.
AC_CHECK_HEADERS(sys/ldr.h)
if test "$ac_cv_header_sys_ldr_h" = "no"; then
have_loadquery=no
else
if test -n "${with_target_subdir}"; then
# When built as a GCC target library, we can't do a link test.
AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
[have_loadquery=no])
else
AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
[have_loadquery=no])
fi
fi
if test "$have_loadquery" = "yes"; then
AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
fi
# Check for the fcntl function.
if test -n "${with_target_subdir}"; then
case "${host}" in
@ -340,6 +372,7 @@ if test "$have_fcntl" = "yes"; then
fi
AC_CHECK_DECLS(strnlen)
AC_CHECK_FUNCS(lstat readlink)
# Check for getexecname function.
if test -n "${with_target_subdir}"; then
@ -354,6 +387,69 @@ if test "$have_getexecname" = "yes"; then
AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
fi
# Check for the clock_gettime function.
AC_CHECK_FUNCS(clock_gettime)
clock_gettime_link=
# At least for glibc, clock_gettime is in librt. But don't
# pull that in if it still doesn't give us the function we want. This
# test is copied from libgomp, and modified to not link in -lrt as
# we're using this for test timing only.
if test "$ac_cv_func_clock_gettime" = no; then
AC_CHECK_LIB(rt, clock_gettime,
[CLOCK_GETTIME_LINK=-lrt
AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
[Define to 1 if you have the `clock_gettime' function.])])
fi
AC_SUBST(CLOCK_GETTIME_LINK)
dnl Test whether the compiler supports the -pthread option.
AC_CACHE_CHECK([whether -pthread is supported],
[libgo_cv_lib_pthread],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -pthread"
AC_COMPILE_IFELSE([[int i;]],
[libgo_cv_lib_pthread=yes],
[libgo_cv_lib_pthread=no])
CFLAGS=$CFLAGS_hold])
PTHREAD_CFLAGS=
if test "$libgo_cv_lib_pthread" = yes; then
PTHREAD_CFLAGS=-pthread
fi
AC_SUBST(PTHREAD_CFLAGS)
AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
AC_CHECK_LIB([z], [compress], [])
if test $ac_cv_lib_z_compress = "yes"; then
AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])
fi
AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
dnl Test whether the linker supports the --compress_debug_sections option.
AC_CACHE_CHECK([whether --compress-debug-sections is supported],
[libgo_cv_ld_compress],
[LDFLAGS_hold=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[libgo_cv_ld_compress=yes],
[libgo_cv_ld_compress=no])
LDFLAGS=$LDFLAGS_hold])
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
AC_ARG_VAR(OBJCOPY, [location of objcopy])
AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
AC_CACHE_CHECK([whether objcopy supports debuglink],
[libbacktrace_cv_objcopy_debuglink],
[if test -n "${with_target_subdir}"; then
libbacktrace_cv_objcopy_debuglink=no
elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then
rm -f /tmp/ls$$
libbacktrace_cv_objcopy_debuglink=yes
else
libbacktrace_cv_objcopy_debuglink=no
fi])
AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
AC_CACHE_CHECK([whether tests can run],
[libbacktrace_cv_sys_native],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],

27
dwarf.c

@ -1,5 +1,5 @@
/* dwarf.c -- Get file/line information from DWARF for backtraces.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
@ -1648,16 +1648,15 @@ add_line (struct backtrace_state *state, struct dwarf_data *ddata,
return 1;
}
/* Free the line header information. If FREE_FILENAMES is true we
free the file names themselves, otherwise we leave them, as there
may be line structures pointing to them. */
/* Free the line header information. */
static void
free_line_header (struct backtrace_state *state, struct line_header *hdr,
backtrace_error_callback error_callback, void *data)
{
backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *),
error_callback, data);
if (hdr->dirs_count != 0)
backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *),
error_callback, data);
backtrace_free (state, hdr->filenames,
hdr->filenames_count * sizeof (char *),
error_callback, data);
@ -1718,12 +1717,16 @@ read_line_header (struct backtrace_state *state, struct unit *u,
++hdr->dirs_count;
}
hdr->dirs = ((const char **)
backtrace_alloc (state,
hdr->dirs_count * sizeof (const char *),
line_buf->error_callback, line_buf->data));
if (hdr->dirs == NULL)
return 0;
hdr->dirs = NULL;
if (hdr->dirs_count != 0)
{
hdr->dirs = ((const char **)
backtrace_alloc (state,
hdr->dirs_count * sizeof (const char *),
line_buf->error_callback, line_buf->data));
if (hdr->dirs == NULL)
return 0;
}
i = 0;
while (*hdr_buf.buf != '\0')

121
edtest.c

@ -0,0 +1,121 @@
/* edtest.c -- Test for libbacktrace storage allocation stress handling
Copyright (C) 2017-2018 Free Software Foundation, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3) The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "backtrace.h"
#include "backtrace-supported.h"
#include "internal.h"
#include "testlib.h"
static int test1 (void) __attribute__ ((noinline, unused));
static int test1 (void) __attribute__ ((noinline, unused));
extern int f2 (int);
extern int f3 (int, int);
static int
test1 (void)
{
/* Returning a value here and elsewhere avoids a tailcall which
would mess up the backtrace. */
return f2 (__LINE__) + 1;
}
int
f3 (int f1line, int f2line)
{
struct info all[20];
struct bdata data;
int f3line;
int i;
data.all = &all[0];
data.index = 0;
data.max = 20;
data.failed = 0;
f3line = __LINE__ + 1;
i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
if (i != 0)
{
fprintf (stderr, "test1: unexpected return value %d\n", i);
data.failed = 1;
}
if (data.index < 3)
{
fprintf (stderr,
"test1: not enough frames; got %zu, expected at least 3\n",
data.index);
data.failed = 1;
}
check ("test1", 0, all, f3line, "f3", "edtest.c", &data.failed);
check ("test1", 1, all, f2line, "f2", "edtest2_build.c", &data.failed);
check ("test1", 2, all, f1line, "test1", "edtest.c", &data.failed);
printf ("%s: backtrace_full alloc stress\n", data.failed ? "FAIL" : "PASS");
if (data.failed)
++failures;
return failures;
}
int
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{
state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
error_callback_create, NULL);
// Grab the storage allocation lock prior to doing anything interesting.
// The intent here is to insure that the backtrace_alloc code is forced
// to always call mmap() for new memory as opposed to reusing previously
// allocated memory from the free list. Doing things this way helps
// simulate what you might see in a multithreaded program in which there
// are racing calls to the allocator.
struct backtrace_state *state_internal =
(struct backtrace_state *) state;
state_internal->lock_alloc = 1;
// Kick off the test
test1();
exit (failures > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}

43
edtest2.c

@ -0,0 +1,43 @@
/* edtest2.c -- Test for libbacktrace storage allocation stress handling (p2)
Copyright (C) 2017-2018 Free Software Foundation, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3) The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
/* This file intentionally written without any #include's
*/
extern int f3(int, int);
extern int f2(int);
int f2(int x)
{
/* Returning a value here and elsewhere avoids a tailcall which
would mess up the backtrace. */
return f3(x, __LINE__) + 3;
}

2588
elf.c
File diff suppressed because it is too large
View File

17
fileline.c

@ -1,5 +1,5 @@
/* fileline.c -- Get file and line number information in a backtrace.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.