Auto merge of #24344 - gfxmonk:update-libbacktrace, r=pnkfelix
On linux, certain crashes can cause rust's backtrace generation code to consume huge amounts of memory (multiple gigabytes) when trying to generate a backtrace (e.g. servo/servo#5340). I tracked this down to a bug in libbacktrace's allocation strategy when processing large binaries, and thankfully it's already been fixed upstream. The change which fixes this specific issue is r210256, and is discussed here: https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00547.html I assume we'd prefer to update libbacktrace wholesale, rather than cherry-picking individual patches, so this PR updates libbacktrace to the latest code from svn://gcc.gnu.org/svn/gcc/trunk/libbacktrace (r220112). I've copied the upstream code and reapplied the parts of the following commits which touch src/libbacktrace: - cd8f31759fd04b9ce9c903fa00cae81dc5bba546 - fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae I have not reapplied f5765793b650e45e8c9bc89dfc7a4dc628123cb7 or d51047ded072b412ec18a6f78c1fb80835a477f5, as those are both cosmetic cleanups applied to the entire codebase. For this directory, it seems worthwhile diverging as little as possible from upstream, to reduce the effort of future updates. But I can add them as well if preferred.
This commit is contained in:
commit
3cac76bcf2
@ -1,3 +1,56 @@
|
||||
2015-01-24 Matthias Klose <doko@ubuntu.com>
|
||||
|
||||
* configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
|
||||
* configure: Regenerate.
|
||||
|
||||
2015-01-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
Update copyright years.
|
||||
|
||||
2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR bootstrap/63784
|
||||
* configure: Regenerated.
|
||||
|
||||
2014-11-11 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* ChangeLog.jit: New.
|
||||
|
||||
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||
|
||||
PR target/63610
|
||||
* configure: Regenerate.
|
||||
|
||||
2014-10-23 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* internal.h (backtrace_atomic_load_pointer) [no atomic or sync]:
|
||||
Fix to return void *.
|
||||
|
||||
2014-05-08 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* mmap.c (backtrace_free): If freeing a large aligned block of
|
||||
memory, call munmap rather than holding onto it.
|
||||
(backtrace_vector_grow): When growing a vector, double the number
|
||||
of pages requested. When releasing the old version of a grown
|
||||
vector, pass the correct size to backtrace_free.
|
||||
|
||||
2014-03-07 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* sort.c (backtrace_qsort): Use middle element as pivot.
|
||||
|
||||
2014-03-06 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* sort.c: New file.
|
||||
* stest.c: New file.
|
||||
* internal.h (backtrace_qsort): Declare.
|
||||
* dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort.
|
||||
(read_line_info, read_function_entry): Likewise.
|
||||
(read_function_info, build_dwarf_data): Likewise.
|
||||
* elf.c (elf_initialize_syminfo): Likewise.
|
||||
* Makefile.am (libbacktrace_la_SOURCES): Add sort.c.
|
||||
(stest_SOURCES, stest_LDADD): Define.
|
||||
(check_PROGRAMS): Add stest.
|
||||
|
||||
2014-02-07 Misty De Meo <misty@brew.sh>
|
||||
|
||||
PR target/58710
|
||||
|
14
src/libbacktrace/ChangeLog.jit
Normal file
14
src/libbacktrace/ChangeLog.jit
Normal file
@ -0,0 +1,14 @@
|
||||
2014-09-24 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* ChangeLog.jit: Add copyright footer.
|
||||
|
||||
2013-10-03 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* configure.ac: Add --enable-host-shared.
|
||||
* configure: Regenerate.
|
||||
|
||||
Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved.
|
@ -1,17 +1,17 @@
|
||||
# Makefile.am -- Backtrace Makefile.
|
||||
# Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015 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.
|
||||
# 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.
|
||||
# distribution.
|
||||
|
||||
# (3) The name of the author may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
@ -46,6 +46,7 @@ libbacktrace_la_SOURCES = \
|
||||
internal.h \
|
||||
posix.c \
|
||||
print.c \
|
||||
sort.c \
|
||||
state.c
|
||||
|
||||
BACKTRACE_FILES = \
|
||||
@ -93,6 +94,11 @@ btest_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += btest
|
||||
|
||||
stest_SOURCES = stest.c
|
||||
stest_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += stest
|
||||
|
||||
endif NATIVE
|
||||
|
||||
# We can't use automake's automatic dependency tracking, because it
|
||||
|
@ -23,12 +23,12 @@
|
||||
# met:
|
||||
|
||||
# (1) Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 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.
|
||||
# distribution.
|
||||
|
||||
# (3) The name of the author may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
@ -67,7 +67,7 @@ build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
check_PROGRAMS = $(am__EXEEXT_1)
|
||||
@NATIVE_TRUE@am__append_1 = btest
|
||||
@NATIVE_TRUE@am__append_1 = btest stest
|
||||
subdir = .
|
||||
DIST_COMMON = README ChangeLog $(srcdir)/Makefile.in \
|
||||
$(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
@ -94,15 +94,18 @@ CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
am_libbacktrace_la_OBJECTS = atomic.lo dwarf.lo fileline.lo posix.lo \
|
||||
print.lo state.lo
|
||||
print.lo sort.lo state.lo
|
||||
libbacktrace_la_OBJECTS = $(am_libbacktrace_la_OBJECTS)
|
||||
@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT)
|
||||
@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT)
|
||||
@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(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 $@
|
||||
@NATIVE_TRUE@am_stest_OBJECTS = stest.$(OBJEXT)
|
||||
stest_OBJECTS = $(am_stest_OBJECTS)
|
||||
@NATIVE_TRUE@stest_DEPENDENCIES = libbacktrace.la
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
@ -116,11 +119,11 @@ 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)
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
$(btest_SOURCES) $(stest_SOURCES)
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
ETAGS = etags
|
||||
@ -264,6 +267,7 @@ libbacktrace_la_SOURCES = \
|
||||
internal.h \
|
||||
posix.c \
|
||||
print.c \
|
||||
sort.c \
|
||||
state.c
|
||||
|
||||
BACKTRACE_FILES = \
|
||||
@ -300,6 +304,8 @@ TESTS = $(check_PROGRAMS)
|
||||
@NATIVE_TRUE@btest_SOURCES = btest.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
|
||||
|
||||
# We can't use automake's automatic dependency tracking, because it
|
||||
# breaks when using bootstrap-lean. Automatic dependency tracking
|
||||
@ -362,7 +368,7 @@ config.h: stamp-h1
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
@ -380,7 +386,7 @@ clean-noinstLTLIBRARIES:
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES)
|
||||
libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES)
|
||||
$(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@ -391,9 +397,12 @@ clean-checkPROGRAMS:
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES)
|
||||
btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES)
|
||||
@rm -f btest$(EXEEXT)
|
||||
$(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS)
|
||||
stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES)
|
||||
@rm -f stest$(EXEEXT)
|
||||
$(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* alloc.c -- Memory allocation without mmap.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* atomic.c -- Support for atomic functions if not present.
|
||||
Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* backtrace-supported.h.in -- Whether stack backtrace is supported.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* backtrace.c -- Entry point for stack backtrace library.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* backtrace.h -- Public header file for stack backtrace library.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* btest.c -- Test for libbacktrace library
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
@ -460,7 +460,7 @@ f23 (int f1line, int f2line)
|
||||
(unsigned int) bdata.index, j + 1);
|
||||
bdata.failed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check ("test3", 0, all, f3line, "f23", &bdata.failed);
|
||||
check ("test3", 1, all, f2line, "f22", &bdata.failed);
|
||||
|
138
src/libbacktrace/configure
vendored
138
src/libbacktrace/configure
vendored
@ -614,7 +614,6 @@ PIC_FLAG
|
||||
WARN_FLAGS
|
||||
EXTRA_FLAGS
|
||||
BACKTRACE_FILE
|
||||
multi_basedir
|
||||
OTOOL64
|
||||
OTOOL
|
||||
LIPO
|
||||
@ -680,6 +679,7 @@ build_os
|
||||
build_vendor
|
||||
build_cpu
|
||||
build
|
||||
multi_basedir
|
||||
target_alias
|
||||
host_alias
|
||||
build_alias
|
||||
@ -721,6 +721,7 @@ SHELL'
|
||||
ac_subst_files=''
|
||||
ac_user_opts='
|
||||
enable_option_checking
|
||||
enable_multilib
|
||||
enable_maintainer_mode
|
||||
with_target_subdir
|
||||
enable_shared
|
||||
@ -729,7 +730,6 @@ with_pic
|
||||
enable_fast_install
|
||||
with_gnu_ld
|
||||
enable_libtool_lock
|
||||
enable_multilib
|
||||
with_system_libunwind
|
||||
enable_host_shared
|
||||
'
|
||||
@ -1362,6 +1362,7 @@ Optional Features:
|
||||
--disable-option-checking ignore unrecognized --enable/--with options
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-multilib build many library versions (default)
|
||||
--enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer
|
||||
--enable-shared[=PKGS] build shared libraries [default=no]
|
||||
@ -1369,7 +1370,6 @@ Optional Features:
|
||||
--enable-fast-install[=PKGS]
|
||||
optimize for fast installation [default=yes]
|
||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--enable-multilib build many library versions (default)
|
||||
--enable-host-shared build host code as shared libraries
|
||||
|
||||
Optional Packages:
|
||||
@ -2453,6 +2453,46 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
if test -n "${with_target_subdir}"; then
|
||||
# Default to --enable-multilib
|
||||
# Check whether --enable-multilib was given.
|
||||
if test "${enable_multilib+set}" = set; then :
|
||||
enableval=$enable_multilib; case "$enableval" in
|
||||
yes) multilib=yes ;;
|
||||
no) multilib=no ;;
|
||||
*) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
|
||||
esac
|
||||
else
|
||||
multilib=yes
|
||||
fi
|
||||
|
||||
|
||||
# We may get other options which we leave undocumented:
|
||||
# --with-target-subdir, --with-multisrctop, --with-multisubdir
|
||||
# See config-ml.in if you want the gory details.
|
||||
|
||||
if test "$srcdir" = "."; then
|
||||
if test "$with_target_subdir" != "."; then
|
||||
multi_basedir="$srcdir/$with_multisrctop../.."
|
||||
else
|
||||
multi_basedir="$srcdir/$with_multisrctop.."
|
||||
fi
|
||||
else
|
||||
multi_basedir="$srcdir/.."
|
||||
fi
|
||||
|
||||
|
||||
# Even if the default multilib is not a cross compilation,
|
||||
# it may be that some of the other multilibs are.
|
||||
if test $cross_compiling = no && test $multilib = yes \
|
||||
&& test "x${with_multisubdir}" != x ; then
|
||||
cross_compiling=maybe
|
||||
fi
|
||||
|
||||
ac_config_commands="$ac_config_commands default-1"
|
||||
|
||||
fi
|
||||
|
||||
ac_aux_dir=
|
||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||
for ac_t in install-sh install.sh shtool; do
|
||||
@ -7576,7 +7616,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
|
||||
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
|
||||
10.0,*86*-darwin8*|10.0,*-darwin[91]*)
|
||||
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
|
||||
10.[012]*)
|
||||
10.[012][,.]*)
|
||||
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
|
||||
10.*)
|
||||
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
|
||||
@ -8879,7 +8919,7 @@ _LT_EOF
|
||||
if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
|
||||
&& test "$tmp_diet" = no
|
||||
then
|
||||
tmp_addflag=
|
||||
tmp_addflag=' $pic_flag'
|
||||
tmp_sharedflag='-shared'
|
||||
case $cc_basename,$host_cpu in
|
||||
pgcc*) # Portland Group C compiler
|
||||
@ -11089,7 +11129,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11092 "configure"
|
||||
#line 11132 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11195,7 +11235,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11198 "configure"
|
||||
#line 11238 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11439,43 +11479,6 @@ backtrace_supported=yes
|
||||
if test -n "${with_target_subdir}"; then
|
||||
# We are compiling a GCC library. We can assume that the unwind
|
||||
# library exists.
|
||||
# Default to --enable-multilib
|
||||
# Check whether --enable-multilib was given.
|
||||
if test "${enable_multilib+set}" = set; then :
|
||||
enableval=$enable_multilib; case "$enableval" in
|
||||
yes) multilib=yes ;;
|
||||
no) multilib=no ;;
|
||||
*) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
|
||||
esac
|
||||
else
|
||||
multilib=yes
|
||||
fi
|
||||
|
||||
|
||||
# We may get other options which we leave undocumented:
|
||||
# --with-target-subdir, --with-multisrctop, --with-multisubdir
|
||||
# See config-ml.in if you want the gory details.
|
||||
|
||||
if test "$srcdir" = "."; then
|
||||
if test "$with_target_subdir" != "."; then
|
||||
multi_basedir="$srcdir/$with_multisrctop../.."
|
||||
else
|
||||
multi_basedir="$srcdir/$with_multisrctop.."
|
||||
fi
|
||||
else
|
||||
multi_basedir="$srcdir/.."
|
||||
fi
|
||||
|
||||
|
||||
# Even if the default multilib is not a cross compilation,
|
||||
# it may be that some of the other multilibs are.
|
||||
if test $cross_compiling = no && test $multilib = yes \
|
||||
&& test "x${with_multisubdir}" != x ; then
|
||||
cross_compiling=maybe
|
||||
fi
|
||||
|
||||
ac_config_commands="$ac_config_commands default-1"
|
||||
|
||||
BACKTRACE_FILE="backtrace.lo simple.lo"
|
||||
else
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
|
||||
@ -13174,6 +13177,20 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
# INIT-COMMANDS
|
||||
#
|
||||
|
||||
srcdir="$srcdir"
|
||||
host="$host"
|
||||
target="$target"
|
||||
with_multisubdir="$with_multisubdir"
|
||||
with_multisrctop="$with_multisrctop"
|
||||
with_target_subdir="$with_target_subdir"
|
||||
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
multi_basedir="$multi_basedir"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
CC="$CC"
|
||||
CXX="$CXX"
|
||||
GFORTRAN="$GFORTRAN"
|
||||
GCJ="$GCJ"
|
||||
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
@ -13434,20 +13451,6 @@ fi
|
||||
|
||||
|
||||
|
||||
srcdir="$srcdir"
|
||||
host="$host"
|
||||
target="$target"
|
||||
with_multisubdir="$with_multisubdir"
|
||||
with_multisrctop="$with_multisrctop"
|
||||
with_target_subdir="$with_target_subdir"
|
||||
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
multi_basedir="$multi_basedir"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
CC="$CC"
|
||||
CXX="$CXX"
|
||||
GFORTRAN="$GFORTRAN"
|
||||
GCJ="$GCJ"
|
||||
|
||||
GCC="$GCC"
|
||||
CC="$CC"
|
||||
acx_cv_header_stdint="$acx_cv_header_stdint"
|
||||
@ -13480,8 +13483,8 @@ for ac_config_target in $ac_config_targets
|
||||
do
|
||||
case $ac_config_target in
|
||||
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
||||
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
|
||||
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
|
||||
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
|
||||
"gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
|
||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
"backtrace-supported.h") CONFIG_FILES="$CONFIG_FILES backtrace-supported.h" ;;
|
||||
@ -14070,6 +14073,14 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
|
||||
|
||||
|
||||
case $ac_file$ac_mode in
|
||||
"default-1":C)
|
||||
# Only add multilib support code if we just rebuilt the top-level
|
||||
# Makefile.
|
||||
case " $CONFIG_FILES " in
|
||||
*" Makefile "*)
|
||||
ac_file=Makefile . ${multi_basedir}/config-ml.in
|
||||
;;
|
||||
esac ;;
|
||||
"libtool":C)
|
||||
|
||||
# See if we are running on zsh, and set the options which allow our
|
||||
@ -14709,14 +14720,6 @@ _LT_EOF
|
||||
chmod +x "$ofile"
|
||||
|
||||
;;
|
||||
"default-1":C)
|
||||
# Only add multilib support code if we just rebuilt the top-level
|
||||
# Makefile.
|
||||
case " $CONFIG_FILES " in
|
||||
*" Makefile "*)
|
||||
ac_file=Makefile . ${multi_basedir}/config-ml.in
|
||||
;;
|
||||
esac ;;
|
||||
"gstdint.h":C)
|
||||
if test "$GCC" = yes; then
|
||||
echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
|
||||
@ -15153,3 +15156,4 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
|
||||
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
||||
fi
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
# configure.ac -- Backtrace configure script.
|
||||
# Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015 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.
|
||||
# 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.
|
||||
|
||||
# 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.
|
||||
@ -34,6 +34,10 @@ AC_INIT(package-unused, version-unused,, libbacktrace)
|
||||
AC_CONFIG_SRCDIR(backtrace.h)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
if test -n "${with_target_subdir}"; then
|
||||
AM_ENABLE_MULTILIB(, ..)
|
||||
fi
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
target_alias=${target_alias-$host_alias}
|
||||
|
||||
@ -83,7 +87,6 @@ backtrace_supported=yes
|
||||
if test -n "${with_target_subdir}"; then
|
||||
# We are compiling a GCC library. We can assume that the unwind
|
||||
# library exists.
|
||||
AM_ENABLE_MULTILIB(, ..)
|
||||
BACKTRACE_FILE="backtrace.lo simple.lo"
|
||||
else
|
||||
AC_CHECK_HEADER([unwind.h],
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* dwarf.c -- Get file/line information from DWARF for backtraces.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
@ -1134,8 +1134,8 @@ read_abbrevs (struct backtrace_state *state, uint64_t abbrev_offset,
|
||||
++num_abbrevs;
|
||||
}
|
||||
|
||||
qsort (abbrevs->abbrevs, abbrevs->num_abbrevs, sizeof (struct abbrev),
|
||||
abbrev_compare);
|
||||
backtrace_qsort (abbrevs->abbrevs, abbrevs->num_abbrevs,
|
||||
sizeof (struct abbrev), abbrev_compare);
|
||||
|
||||
return 1;
|
||||
|
||||
@ -1241,7 +1241,7 @@ add_unit_ranges (struct backtrace_state *state, uintptr_t base_address,
|
||||
|
||||
static int
|
||||
find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
|
||||
struct dwarf_buf *unit_buf,
|
||||
struct dwarf_buf *unit_buf,
|
||||
const unsigned char *dwarf_str, size_t dwarf_str_size,
|
||||
const unsigned char *dwarf_ranges,
|
||||
size_t dwarf_ranges_size,
|
||||
@ -1599,7 +1599,7 @@ read_line_header (struct backtrace_state *state, struct unit *u,
|
||||
|
||||
if (!advance (line_buf, hdrlen))
|
||||
return 0;
|
||||
|
||||
|
||||
hdr->min_insn_len = read_byte (&hdr_buf);
|
||||
if (hdr->version < 4)
|
||||
hdr->max_ops_per_insn = 1;
|
||||
@ -1608,7 +1608,7 @@ read_line_header (struct backtrace_state *state, struct unit *u,
|
||||
|
||||
/* We don't care about default_is_stmt. */
|
||||
read_byte (&hdr_buf);
|
||||
|
||||
|
||||
hdr->line_base = read_sbyte (&hdr_buf);
|
||||
hdr->line_range = read_byte (&hdr_buf);
|
||||
|
||||
@ -2016,7 +2016,7 @@ read_line_info (struct backtrace_state *state, struct dwarf_data *ddata,
|
||||
goto fail;
|
||||
|
||||
ln = (struct line *) vec.vec.base;
|
||||
qsort (ln, vec.count, sizeof (struct line), line_compare);
|
||||
backtrace_qsort (ln, vec.count, sizeof (struct line), line_compare);
|
||||
|
||||
*lines = ln;
|
||||
*lines_count = vec.count;
|
||||
@ -2476,9 +2476,9 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
|
||||
return 0;
|
||||
|
||||
faddrs = (struct function_addrs *) fvec.vec.base;
|
||||
qsort (faddrs, fvec.count,
|
||||
sizeof (struct function_addrs),
|
||||
function_addrs_compare);
|
||||
backtrace_qsort (faddrs, fvec.count,
|
||||
sizeof (struct function_addrs),
|
||||
function_addrs_compare);
|
||||
|
||||
function->function_addrs = faddrs;
|
||||
function->function_addrs_count = fvec.count;
|
||||
@ -2555,8 +2555,8 @@ read_function_info (struct backtrace_state *state, struct dwarf_data *ddata,
|
||||
fvec->count = 0;
|
||||
}
|
||||
|
||||
qsort (addrs, addrs_count, sizeof (struct function_addrs),
|
||||
function_addrs_compare);
|
||||
backtrace_qsort (addrs, addrs_count, sizeof (struct function_addrs),
|
||||
function_addrs_compare);
|
||||
|
||||
*ret_addrs = addrs;
|
||||
*ret_addrs_count = addrs_count;
|
||||
@ -2923,7 +2923,8 @@ build_dwarf_data (struct backtrace_state *state,
|
||||
return NULL;
|
||||
addrs = (struct unit_addrs *) addrs_vec.vec.base;
|
||||
addrs_count = addrs_vec.count;
|
||||
qsort (addrs, addrs_count, sizeof (struct unit_addrs), unit_addrs_compare);
|
||||
backtrace_qsort (addrs, addrs_count, sizeof (struct unit_addrs),
|
||||
unit_addrs_compare);
|
||||
|
||||
fdata = ((struct dwarf_data *)
|
||||
backtrace_alloc (state, sizeof (struct dwarf_data),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* elf.c -- Get debug data from an ELF file for backtraces.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
@ -407,8 +407,8 @@ elf_initialize_syminfo (struct backtrace_state *state,
|
||||
++j;
|
||||
}
|
||||
|
||||
qsort (elf_symbols, elf_symbol_count, sizeof (struct elf_symbol),
|
||||
elf_symbol_compare);
|
||||
backtrace_qsort (elf_symbols, elf_symbol_count, sizeof (struct elf_symbol),
|
||||
elf_symbol_compare);
|
||||
|
||||
sdata->next = NULL;
|
||||
sdata->symbols = elf_symbols;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* fileline.c -- Get file and line number information in a backtrace.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* internal.h -- Internal header file for stack backtrace library.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
@ -99,7 +99,7 @@ extern void backtrace_atomic_store_int (int *, int);
|
||||
/* We have neither the sync nor the atomic functions. These will
|
||||
never be called. */
|
||||
|
||||
#define backtrace_atomic_load_pointer(p) (abort(), 0)
|
||||
#define backtrace_atomic_load_pointer(p) (abort(), (void *) NULL)
|
||||
#define backtrace_atomic_load_int(p) (abort(), 0)
|
||||
#define backtrace_atomic_store_pointer(p, v) abort()
|
||||
#define backtrace_atomic_store_size_t(p, v) abort()
|
||||
@ -196,6 +196,11 @@ extern int backtrace_close (int descriptor,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data);
|
||||
|
||||
/* Sort without using memory. */
|
||||
|
||||
extern void backtrace_qsort (void *base, size_t count, size_t size,
|
||||
int (*compar) (const void *, const void *));
|
||||
|
||||
/* Allocate memory. This is like malloc. */
|
||||
|
||||
extern void *backtrace_alloc (struct backtrace_state *state, size_t size,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* mmap.c -- Memory allocation with mmap.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
@ -164,6 +164,26 @@ backtrace_free (struct backtrace_state *state, void *addr, size_t size,
|
||||
{
|
||||
int locked;
|
||||
|
||||
/* If we are freeing a large aligned block, just release it back to
|
||||
the system. This case arises when growing a vector for a large
|
||||
binary with lots of debug info. Calling munmap here may cause us
|
||||
to call mmap again if there is also a large shared library; we
|
||||
just live with that. */
|
||||
if (size >= 16 * 4096)
|
||||
{
|
||||
size_t pagesize;
|
||||
|
||||
pagesize = getpagesize ();
|
||||
if (((uintptr_t) addr & (pagesize - 1)) == 0
|
||||
&& (size & (pagesize - 1)) == 0)
|
||||
{
|
||||
/* If munmap fails for some reason, just add the block to
|
||||
the freelist. */
|
||||
if (munmap (addr, size) == 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we can acquire the lock, add the new space to the free list.
|
||||
If we can't acquire the lock, just leak the memory.
|
||||
__sync_lock_test_and_set returns the old state of the lock, so we
|
||||
@ -209,14 +229,18 @@ backtrace_vector_grow (struct backtrace_state *state,size_t size,
|
||||
alc = pagesize;
|
||||
}
|
||||
else
|
||||
alc = (alc + pagesize - 1) & ~ (pagesize - 1);
|
||||
{
|
||||
alc *= 2;
|
||||
alc = (alc + pagesize - 1) & ~ (pagesize - 1);
|
||||
}
|
||||
base = backtrace_alloc (state, alc, error_callback, data);
|
||||
if (base == NULL)
|
||||
return NULL;
|
||||
if (vec->base != NULL)
|
||||
{
|
||||
memcpy (base, vec->base, vec->size);
|
||||
backtrace_free (state, vec->base, vec->alc, error_callback, data);
|
||||
backtrace_free (state, vec->base, vec->size + vec->alc,
|
||||
error_callback, data);
|
||||
}
|
||||
vec->base = base;
|
||||
vec->alc = alc - vec->size;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* mmapio.c -- File views using mmap.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* backtrace.c -- Entry point for stack backtrace library.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* posix.c -- POSIX file I/O routines for the backtrace library.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* print.c -- Print the current backtrace.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* read.c -- File views without mmap.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* simple.c -- The backtrace_simple function.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
108
src/libbacktrace/sort.c
Normal file
108
src/libbacktrace/sort.c
Normal file
@ -0,0 +1,108 @@
|
||||
/* sort.c -- Sort without allocating memory
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
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 <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "internal.h"
|
||||
|
||||
/* The GNU glibc version of qsort allocates memory, which we must not
|
||||
do if we are invoked by a signal handler. So provide our own
|
||||
sort. */
|
||||
|
||||
static void
|
||||
swap (char *a, char *b, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < size; i++, a++, b++)
|
||||
{
|
||||
char t;
|
||||
|
||||
t = *a;
|
||||
*a = *b;
|
||||
*b = t;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
backtrace_qsort (void *basearg, size_t count, size_t size,
|
||||
int (*compar) (const void *, const void *))
|
||||
{
|
||||
char *base = (char *) basearg;
|
||||
size_t i;
|
||||
size_t mid;
|
||||
|
||||
tail_recurse:
|
||||
if (count < 2)
|
||||
return;
|
||||
|
||||
/* The symbol table and DWARF tables, which is all we use this
|
||||
routine for, tend to be roughly sorted. Pick the middle element
|
||||
in the array as our pivot point, so that we are more likely to
|
||||
cut the array in half for each recursion step. */
|
||||
swap (base, base + (count / 2) * size, size);
|
||||
|
||||
mid = 0;
|
||||
for (i = 1; i < count; i++)
|
||||
{
|
||||
if ((*compar) (base, base + i * size) > 0)
|
||||
{
|
||||
++mid;
|
||||
if (i != mid)
|
||||
swap (base + mid * size, base + i * size, size);
|
||||
}
|
||||
}
|
||||
|
||||
if (mid > 0)
|
||||
swap (base, base + mid * size, size);
|
||||
|
||||
/* Recurse with the smaller array, loop with the larger one. That
|
||||
ensures that our maximum stack depth is log count. */
|
||||
if (2 * mid < count)
|
||||
{
|
||||
backtrace_qsort (base, mid, size, compar);
|
||||
base += (mid + 1) * size;
|
||||
count -= mid + 1;
|
||||
goto tail_recurse;
|
||||
}
|
||||
else
|
||||
{
|
||||
backtrace_qsort (base + (mid + 1) * size, count - (mid + 1),
|
||||
size, compar);
|
||||
count = mid;
|
||||
goto tail_recurse;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/* state.c -- Create the backtrace state.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
137
src/libbacktrace/stest.c
Normal file
137
src/libbacktrace/stest.c
Normal file
@ -0,0 +1,137 @@
|
||||
/* stest.c -- Test for libbacktrace internal sort function
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "internal.h"
|
||||
|
||||
/* Test the local qsort implementation. */
|
||||
|
||||
#define MAX 10
|
||||
|
||||
struct test
|
||||
{
|
||||
size_t count;
|
||||
int input[MAX];
|
||||
int output[MAX];
|
||||
};
|
||||
|
||||
static struct test tests[] =
|
||||
{
|
||||
{
|
||||
10,
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
|
||||
},
|
||||
{
|
||||
9,
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9 }
|
||||
},
|
||||
{
|
||||
10,
|
||||
{ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
||||
},
|
||||
{
|
||||
9,
|
||||
{ 9, 8, 7, 6, 5, 4, 3, 2, 1 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9 },
|
||||
},
|
||||
{
|
||||
10,
|
||||
{ 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
||||
},
|
||||
{
|
||||
5,
|
||||
{ 4, 5, 3, 1, 2 },
|
||||
{ 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
5,
|
||||
{ 1, 1, 1, 1, 1 },
|
||||
{ 1, 1, 1, 1, 1 },
|
||||
},
|
||||
{
|
||||
5,
|
||||
{ 1, 1, 2, 1, 1 },
|
||||
{ 1, 1, 1, 1, 2 },
|
||||
},
|
||||
{
|
||||
5,
|
||||
{ 2, 1, 1, 1, 1 },
|
||||
{ 1, 1, 1, 1, 2 },
|
||||
},
|
||||
};
|
||||
|
||||
static int
|
||||
compare (const void *a, const void *b)
|
||||
{
|
||||
const int *ai = (const int *) a;
|
||||
const int *bi = (const int *) b;
|
||||
|
||||
return *ai - *bi;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int failures;
|
||||
size_t i;
|
||||
int a[MAX];
|
||||
|
||||
failures = 0;
|
||||
for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
|
||||
{
|
||||
memcpy (a, tests[i].input, tests[i].count * sizeof (int));
|
||||
backtrace_qsort (a, tests[i].count, sizeof (int), compare);
|
||||
if (memcmp (a, tests[i].output, tests[i].count * sizeof (int)) != 0)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
fprintf (stderr, "test %d failed:", (int) i);
|
||||
for (j = 0; j < tests[i].count; j++)
|
||||
fprintf (stderr, " %d", a[j]);
|
||||
fprintf (stderr, "\n");
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
|
||||
exit (failures > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/* unknown.c -- used when backtrace configury does not know file format.
|
||||
Copyright (C) 2012-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -7,13 +7,13 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user