aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-11-03 08:42:11 +0000
committerUlrich Drepper <drepper@redhat.com>2002-11-03 08:42:11 +0000
commit45cca066c1aea789435d0ee69ea8b0170f9edcdc (patch)
tree991d6154727d0d26d8fc1da48a41571a625826be
parentc213fe9c7dc7852784fd5303506072a9d01b8d12 (diff)
downloadglibc-45cca066c1aea789435d0ee69ea8b0170f9edcdc.tar
glibc-45cca066c1aea789435d0ee69ea8b0170f9edcdc.tar.gz
glibc-45cca066c1aea789435d0ee69ea8b0170f9edcdc.tar.bz2
glibc-45cca066c1aea789435d0ee69ea8b0170f9edcdc.zip
(catch_segfault): If HAVE_PROC_SELF is defined write out memory map.
-rw-r--r--sysdeps/generic/segfault.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
index dc4ac178ee..168731479a 100644
--- a/sysdeps/generic/segfault.c
+++ b/sysdeps/generic/segfault.c
@@ -1,5 +1,5 @@
/* Catch segmentation faults and print backtrace.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -169,6 +169,23 @@ catch_segfault (int signal, SIGCONTEXT ctx)
/* Now generate nicely formatted output. */
__backtrace_symbols_fd (arr, cnt, fd);
+#ifdef HAVE_PROC_SELF
+ /* Now the link map. */
+ int mapfd = open ("/proc/self/maps", O_RDONLY);
+ if (mapfd != -1)
+ {
+ write (fd, "\nMemory map:\n\n", 14);
+
+ char buf[256];
+ ssize_t n;
+
+ while ((n = TEMP_FAILURE_RETRY (read (mapfd, buf, sizeof (buf)))) > 0)
+ TEMP_FAILURE_RETRY (write (fd, buf, n));
+
+ close (mapfd);
+ }
+#endif
+
/* Pass on the signal (so that a core file is produced). */
sa.sa_handler = SIG_DFL;
sigemptyset (&sa.sa_mask);