aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-08-24 21:04:08 -0700
committerPaul Eggert2012-08-24 21:04:08 -0700
commitf4a681b077a4af9f1eb36e0a109003262e2dafd1 (patch)
treef08a7aea4f14c0581b848931007ab892bda3b7b7
parent2f221583cf4a4b412c16260d148b59931b12455a (diff)
downloademacs-f4a681b077a4af9f1eb36e0a109003262e2dafd1.tar.gz
emacs-f4a681b077a4af9f1eb36e0a109003262e2dafd1.zip
On assertion failure, print backtrace if available.
Merge from gnulib, incorporating: 2012-08-24 execinfo: port to FreeBSD 2012-08-22 execinfo: new module * admin/merge-gnulib (GNULIB_MODULES): Add execinfo. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files. * src/alloc.c [ENABLE_CHECKING]: Include <execinfo.h>. (die) [ENABLE_CHECKING]: Print a backtrace if available. * src/Makefile.in (LIB_EXECINFO): New macro. (LIBES): Use it.
-rw-r--r--ChangeLog9
-rw-r--r--admin/ChangeLog5
-rwxr-xr-xadmin/merge-gnulib2
-rw-r--r--lib/gnulib.mk27
-rw-r--r--m4/gnulib-comp.m45
-rw-r--r--src/ChangeLog6
-rw-r--r--src/Makefile.in3
-rw-r--r--src/alloc.c8
8 files changed, 63 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5657f8bb3aa..8ffa630c16d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
12012-08-24 Paul Eggert <eggert@cs.ucla.edu>
2
3 On assertion failure, print backtrace if available.
4 Merge from gnulib, incorporating:
5 2012-08-24 execinfo: port to FreeBSD
6 2012-08-22 execinfo: new module
7 * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
8 * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files.
9
12012-08-22 Glenn Morris <rgm@gnu.org> 102012-08-22 Glenn Morris <rgm@gnu.org>
2 11
3 * Makefile.in (install-arch-dep): If NO_BIN_LINK is non-null, 12 * Makefile.in (install-arch-dep): If NO_BIN_LINK is non-null,
diff --git a/admin/ChangeLog b/admin/ChangeLog
index ea977e80cfa..0c674b91ea4 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,8 @@
12012-08-24 Paul Eggert <eggert@cs.ucla.edu>
2
3 On assertion failure, print backtrace if available.
4 * merge-gnulib (GNULIB_MODULES): Add execinfo.
5
12012-08-16 Paul Eggert <eggert@cs.ucla.edu> 62012-08-16 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Use ASCII tests for character types. 8 Use ASCII tests for character types.
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 63865edf3ce..775d43e68d3 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -28,7 +28,7 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
28GNULIB_MODULES=' 28GNULIB_MODULES='
29 alloca-opt c-ctype c-strcase 29 alloca-opt c-ctype c-strcase
30 careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 30 careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
31 dtoastr dtotimespec dup2 environ 31 dtoastr dtotimespec dup2 environ execinfo
32 filemode getloadavg getopt-gnu gettime gettimeofday 32 filemode getloadavg getopt-gnu gettime gettimeofday
33 ignore-value intprops largefile lstat 33 ignore-value intprops largefile lstat
34 manywarnings mktime pselect pthread_sigmask readlink 34 manywarnings mktime pselect pthread_sigmask readlink
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index a90cc59bbde..d49eb4fdf7a 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings 24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -150,6 +150,31 @@ EXTRA_libgnu_a_SOURCES += dup2.c
150 150
151## end gnulib module dup2 151## end gnulib module dup2
152 152
153## begin gnulib module execinfo
154
155BUILT_SOURCES += $(EXECINFO_H)
156
157# We need the following in order to create <execinfo.h> when the system
158# doesn't have one that works.
159if GL_GENERATE_EXECINFO_H
160execinfo.h: execinfo.in.h $(top_builddir)/config.status
161 $(AM_V_GEN)rm -f $@-t $@ && \
162 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
163 cat $(srcdir)/execinfo.in.h; \
164 } > $@-t && \
165 mv $@-t $@
166else
167execinfo.h: $(top_builddir)/config.status
168 rm -f $@
169endif
170MOSTLYCLEANFILES += execinfo.h execinfo.h-t
171
172EXTRA_DIST += execinfo.c execinfo.in.h
173
174EXTRA_libgnu_a_SOURCES += execinfo.c
175
176## end gnulib module execinfo
177
153## begin gnulib module filemode 178## begin gnulib module filemode
154 179
155libgnu_a_SOURCES += filemode.c 180libgnu_a_SOURCES += filemode.c
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 12c8ca8734b..0d73faee8d1 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -53,6 +53,7 @@ AC_DEFUN([gl_EARLY],
53 # Code from module dtotimespec: 53 # Code from module dtotimespec:
54 # Code from module dup2: 54 # Code from module dup2:
55 # Code from module environ: 55 # Code from module environ:
56 # Code from module execinfo:
56 # Code from module extensions: 57 # Code from module extensions:
57 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 58 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
58 # Code from module extern-inline: 59 # Code from module extern-inline:
@@ -152,6 +153,7 @@ AC_DEFUN([gl_INIT],
152 gl_UNISTD_MODULE_INDICATOR([dup2]) 153 gl_UNISTD_MODULE_INDICATOR([dup2])
153 gl_ENVIRON 154 gl_ENVIRON
154 gl_UNISTD_MODULE_INDICATOR([environ]) 155 gl_UNISTD_MODULE_INDICATOR([environ])
156 gl_EXECINFO_H
155 AC_REQUIRE([gl_EXTERN_INLINE]) 157 AC_REQUIRE([gl_EXTERN_INLINE])
156 gl_FILEMODE 158 gl_FILEMODE
157 gl_GETLOADAVG 159 gl_GETLOADAVG
@@ -534,6 +536,8 @@ AC_DEFUN([gl_FILE_LIST], [
534 lib/dtoastr.c 536 lib/dtoastr.c
535 lib/dtotimespec.c 537 lib/dtotimespec.c
536 lib/dup2.c 538 lib/dup2.c
539 lib/execinfo.c
540 lib/execinfo.in.h
537 lib/filemode.c 541 lib/filemode.c
538 lib/filemode.h 542 lib/filemode.h
539 lib/ftoastr.c 543 lib/ftoastr.c
@@ -605,6 +609,7 @@ AC_DEFUN([gl_FILE_LIST], [
605 m4/clock_time.m4 609 m4/clock_time.m4
606 m4/dup2.m4 610 m4/dup2.m4
607 m4/environ.m4 611 m4/environ.m4
612 m4/execinfo.m4
608 m4/extensions.m4 613 m4/extensions.m4
609 m4/extern-inline.m4 614 m4/extern-inline.m4
610 m4/filemode.m4 615 m4/filemode.m4
diff --git a/src/ChangeLog b/src/ChangeLog
index 95b9a57f24b..fbaf555f8b2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12012-08-25 Paul Eggert <eggert@cs.ucla.edu> 12012-08-25 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 On assertion failure, print backtrace if available.
4 * alloc.c [ENABLE_CHECKING]: Include <execinfo.h>.
5 (die) [ENABLE_CHECKING]: Print a backtrace if available.
6 * Makefile.in (LIB_EXECINFO): New macro.
7 (LIBES): Use it.
8
3 * bytecode.c, callint.c, callproc.c: Use bool for boolean. 9 * bytecode.c, callint.c, callproc.c: Use bool for boolean.
4 * bytecode.c (exec_byte_code): 10 * bytecode.c (exec_byte_code):
5 * callint.c (check_mark, Fcall_interactively): 11 * callint.c (check_mark, Fcall_interactively):
diff --git a/src/Makefile.in b/src/Makefile.in
index 1d89af31401..85645222052 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -159,6 +159,8 @@ DBUS_LIBS = @DBUS_LIBS@
159## dbusbind.o if HAVE_DBUS, else empty. 159## dbusbind.o if HAVE_DBUS, else empty.
160DBUS_OBJ = @DBUS_OBJ@ 160DBUS_OBJ = @DBUS_OBJ@
161 161
162LIB_EXECINFO=@LIB_EXECINFO@
163
162SETTINGS_CFLAGS = @SETTINGS_CFLAGS@ 164SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
163SETTINGS_LIBS = @SETTINGS_LIBS@ 165SETTINGS_LIBS = @SETTINGS_LIBS@
164 166
@@ -383,6 +385,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
383## with GCC, we might need LIB_GCC again after them. 385## with GCC, we might need LIB_GCC again after them.
384LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ 386LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
385 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \ 387 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \
388 $(LIB_EXECINFO) \
386 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 389 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
387 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 390 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
388 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 391 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
diff --git a/src/alloc.c b/src/alloc.c
index f0da9416ece..961febb6dff 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6681,13 +6681,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6681} 6681}
6682 6682
6683#ifdef ENABLE_CHECKING 6683#ifdef ENABLE_CHECKING
6684
6685# include <execinfo.h>
6686
6684bool suppress_checking; 6687bool suppress_checking;
6685 6688
6686void 6689void
6687die (const char *msg, const char *file, int line) 6690die (const char *msg, const char *file, int line)
6688{ 6691{
6692 enum { NPOINTERS_MAX = 500 };
6693 void *buffer[NPOINTERS_MAX];
6694 int npointers;
6689 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", 6695 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
6690 file, line, msg); 6696 file, line, msg);
6697 npointers = backtrace (buffer, NPOINTERS_MAX);
6698 backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
6691 abort (); 6699 abort ();
6692} 6700}
6693#endif 6701#endif