[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r3562 - in /trunk/libc: ./ debug/ nptl/ sysdeps/unix/sysv/linux/
- To: commits@xxxxxxxxxx
- Subject: [commits] r3562 - in /trunk/libc: ./ debug/ nptl/ sysdeps/unix/sysv/linux/
- From: jimb@xxxxxxxxxx
- Date: Sat, 22 Sep 2007 00:25:03 -0000
Author: jimb
Date: Fri Sep 21 17:25:02 2007
New Revision: 3562
Log:
Implement the OPTION_EGLIBC_BACKTRACE option group.
* option-groups.def (OPTION_EGLIBC_BACKTRACE): New entry.
* option-groups.defaults (OPTION_EGLIBC_BACKTRACE): Initialize.
* debug/Makefile (routines): Put all backtrace, backtracesyms, and
backtracesymsfd in the group.
(tests): Put backtrace-tst in the group.
(CFLAGS-segfault.c): Define OPTION_EGLIBC_BACKTRACE as
appropriate.
* debug/segfault.c (catch_segfault): Only produce a backtrace when
the group is enabled.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-libc_fatal.c): Define
OPTION_EGLIBC_BACKTRACE as appropriate.
* sysdeps/unix/sysv/linux/libc_fatal.c (__libc_message): Don't
print a backtrace if the group is not enabled.
* nptl/Makefile (tests): Put tst-backtrace1 in the option group.
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/debug/Makefile
trunk/libc/debug/segfault.c
trunk/libc/nptl/Makefile
trunk/libc/option-groups.def
trunk/libc/option-groups.defaults
trunk/libc/sysdeps/unix/sysv/linux/Makefile
trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Fri Sep 21 17:25:02 2007
@@ -1,3 +1,21 @@
+2007-09-21 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
+
+ Implement the OPTION_EGLIBC_BACKTRACE option group.
+ * option-groups.def (OPTION_EGLIBC_BACKTRACE): New entry.
+ * option-groups.defaults (OPTION_EGLIBC_BACKTRACE): Initialize.
+ * debug/Makefile (routines): Put all backtrace, backtracesyms, and
+ backtracesymsfd in the group.
+ (tests): Put backtrace-tst in the group.
+ (CFLAGS-segfault.c): Define OPTION_EGLIBC_BACKTRACE as
+ appropriate.
+ * debug/segfault.c (catch_segfault): Only produce a backtrace when
+ the group is enabled.
+ * sysdeps/unix/sysv/linux/Makefile (CFLAGS-libc_fatal.c): Define
+ OPTION_EGLIBC_BACKTRACE as appropriate.
+ * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_message): Don't
+ print a backtrace if the group is not enabled.
+ * nptl/Makefile (tests): Put tst-backtrace1 in the option group.
+
2007-09-14 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
* locale/programs/ld-collate.c (collate_output): Remove extra call
Modified: trunk/libc/debug/Makefile
==============================================================================
--- trunk/libc/debug/Makefile (original)
+++ trunk/libc/debug/Makefile Fri Sep 21 17:25:02 2007
@@ -26,7 +26,7 @@
headers := execinfo.h
distribute = sigcontextinfo.h register-dump.h frame.h
-routines = backtrace backtracesyms backtracesymsfd noophooks \
+routines = noophooks \
memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
@@ -47,6 +47,7 @@
stack_chk_fail fortify_fail \
$(static-only-routines)
routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin_r_chk
+routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd
static-only-routines := warning-nop stack_chk_fail_local
CFLAGS-backtrace.c = -fno-omit-frame-pointer
@@ -89,14 +90,18 @@
tst-lfschk2-ENV = LOCPATH=$(common-objpfx)localedata
tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
-tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
+tests = tst-chk1 tst-chk2 tst-chk3 \
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
+tests-$(OPTION_EGLIBC_BACKTRACE) += backtrace-tst
extra-libs = libSegFault libpcprofile
extra-libs-others = $(extra-libs)
libSegFault-routines = segfault
libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
+OPTION_EGLIBC_BACKTRACE-CFLAGS-$(OPTION_EGLIBC_BACKTRACE) \
+ = -DOPTION_EGLIBC_BACKTRACE
+CFLAGS-segfault.c = $(OPTION_EGLIBC_BACKTRACE-CFLAGS-y)
libpcprofile-routines = pcprofile
libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
Modified: trunk/libc/debug/segfault.c
==============================================================================
--- trunk/libc/debug/segfault.c (original)
+++ trunk/libc/debug/segfault.c Fri Sep 21 17:25:02 2007
@@ -95,6 +95,7 @@
REGISTER_DUMP;
#endif
+#ifdef OPTION_EGLIBC_BACKTRACE
WRITE_STRING ("\nBacktrace:\n");
/* Get the backtrace. */
@@ -117,6 +118,7 @@
/* Now generate nicely formatted output. */
__backtrace_symbols_fd (arr + i, cnt - i, fd);
+#endif
#ifdef HAVE_PROC_SELF
/* Now the link map. */
Modified: trunk/libc/nptl/Makefile
==============================================================================
--- trunk/libc/nptl/Makefile (original)
+++ trunk/libc/nptl/Makefile Fri Sep 21 17:25:02 2007
@@ -260,7 +260,6 @@
tst-clock1 \
tst-context1 \
tst-sched1 \
- tst-backtrace1 \
tst-oddstacklimit \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
tst-getpid1 tst-getpid2 tst-getpid3 \
@@ -269,6 +268,9 @@
# This test uses the posix_spawn functions.
tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
+
+# This test uses the 'backtrace' functions.
+tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
# Files which must not be linked with libpthread.
tests-nolibpthread = tst-unload
Modified: trunk/libc/option-groups.def
==============================================================================
--- trunk/libc/option-groups.def (original)
+++ trunk/libc/option-groups.def Fri Sep 21 17:25:02 2007
@@ -70,6 +70,20 @@
inet6_rth_reverse
inet6_rth_segments
inet6_rth_space
+
+config OPTION_EGLIBC_BACKTRACE
+ bool "Functions for producing backtraces"
+ help
+ This option group includes functions for producing a list of
+ the function calls that are currently active in a thread, from
+ within the thread itself. These functions are often used
+ within signal handlers, to produce diagnostic output.
+
+ This option group includes the following functions:
+
+ backtrace
+ backtrace_symbols
+ backtrace_symbols_fd
config OPTION_EGLIBC_BSD
bool "BSD-specific functions, and their compatibility stubs"
Modified: trunk/libc/option-groups.defaults
==============================================================================
--- trunk/libc/option-groups.defaults (original)
+++ trunk/libc/option-groups.defaults Fri Sep 21 17:25:02 2007
@@ -9,6 +9,7 @@
#
# By default, all option groups are enabled.
OPTION_EGLIBC_ADVANCED_INET6 = y
+OPTION_EGLIBC_BACKTRACE = y
OPTION_EGLIBC_BSD = y
OPTION_EGLIBC_CATGETS = y
OPTION_EGLIBC_CHARSETS = y
Modified: trunk/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/Makefile Fri Sep 21 17:25:02 2007
@@ -19,6 +19,10 @@
inet-CFLAGS-$(OPTION_EGLIBC_INET) = -DOPTION_EGLIBC_INET
CFLAGS-gethostid.c = -fexceptions $(inet-CFLAGS-y)
+
+OPTION_EGLIBC_BACKTRACE-CFLAGS-$(OPTION_EGLIBC_BACKTRACE) \
+ = -DOPTION_EGLIBC_BACKTRACE
+CFLAGS-libc_fatal.c += $(OPTION_EGLIBC_BACKTRACE-CFLAGS-y)
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
sys/klog.h sys/kdaemon.h \
Modified: trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c Fri Sep 21 17:25:02 2007
@@ -143,6 +143,7 @@
if (do_abort)
{
+#ifdef OPTION_EGLIBC_BACKTRACE
if (do_abort > 1 && written)
{
void *addrs[64];
@@ -165,6 +166,7 @@
close_not_cancel_no_status (fd2);
}
}
+#endif /* OPTION_EGLIBC_BACKTRACE */
/* Terminate the process. */
abort ();