aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-rw-r--r--debug/Makefile13
-rw-r--r--debug/Versions4
-rw-r--r--debug/execinfo.h9
3 files changed, 23 insertions, 3 deletions
diff --git a/debug/Makefile b/debug/Makefile
index 5286cc1..3ee7a9f 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -23,10 +23,21 @@ subdir := debug
headers := execinfo.h
-routines := backtrace backtracesyms
+routines := backtrace backtracesyms backtracesymsfd
CFLAGS-backtrace.c = -fno-omit-frame-pointer
tests = backtrace-tst
+extra-libs = libSegFault
+extra-libs-others = $(extra-libs)
+
+libSegFault-routines = segfault
+libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
+
include ../Rules
+
+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
+# This ensures they will load libc.so for needed symbols if loaded by
+# a statically-linked program that hasn't already loaded it.
+$(objpfx)libSegFault.so: $(common-objpfx)libc.so $(common-objpfx)elf/ld.so
diff --git a/debug/Versions b/debug/Versions
index 28518d5..01d390e 100644
--- a/debug/Versions
+++ b/debug/Versions
@@ -1,9 +1,9 @@
libc {
GLIBC_2.1 {
# functions used in other libraries
- __backtrace; __backtrace_symbols;
+ __backtrace; __backtrace_symbols; __backtrace_symbols_fd;
# b*
- backtrace; backtrace_symbols;
+ backtrace; backtrace_symbols; backtrace_symbols_fd;
}
}
diff --git a/debug/execinfo.h b/debug/execinfo.h
index bf757ed..9e0e551 100644
--- a/debug/execinfo.h
+++ b/debug/execinfo.h
@@ -34,6 +34,15 @@ extern int backtrace __P ((void **__array, int __size));
extern char **__backtrace_symbols __P ((void *__const *__array, int __size));
extern char **backtrace_symbols __P ((void *__const *__array, int __size));
+
+/* This function is similar to backtrace_symbols() but it writes the result
+ immediately to a file and can therefore also be used in situations where
+ malloc() is not usable anymore. */
+extern void __backtrace_symbols_fd __P ((void *__const *__array, int __size,
+ int __fd));
+extern void backtrace_symbols_fd __P ((void *__const *__array, int __size,
+ int __fd));
+
__END_DECLS
#endif /* execinfo.h */