mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
1998-08-24 16:34 Ulrich Drepper <drepper@cygnus.com> * debug/catchsegv.sh: Handle text preceding backtrace better. * sysdeps/generic/segfault.c: Allow register dump. Allow handler to be installed for other signals than SIGSEGV. * sysdeps/generic/register-dump.h: New file. * sysdeps/i386/register-dump.h: New file. * sysdeps/powerpc/register-dump.h: New file. * sysdeps/unix/sysv/linux/i386/profil-counter.h: Use macros from sigcontextinfo.h. * sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Use i386 version. 1998-08-24 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: New file. 1998-08-09 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/unix/sysv/linux/powerpc/chown.c: New file. * sysdeps/unix/sysv/linux/powerpc/lchown.S: New file. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Add chown, remove getresuid, getresgid. 1998-08-16 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/unix/sysv/linux/powerpc/clone.S: Fix bugs. Set up stack pointer in userland. 1998-08-21 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/sys/mount.h (MNT_FORCE): Define as enum and fix value. 1998-08-22 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/ldd.bash.in: Add missing quotes around $file. Make loop over arguments Bourne shell compatible. Don't exit unsuccessfully if nonelf returns successfully. Avoid duplicating most of the script. * sysdeps/unix/sysv/linux/ldd-rewrite.sed: Add missing quotes around $file. 1998-08-24 10:37 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/Versions (_IO_do_write, _IO_file_attach, _IO_file_close_it, _IO_file_finish, _IO_file_fopen, _IO_file_init, _IO_file_overflow, _IO_file_seekoff, _IO_file_setbuf, _IO_file_sync, _IO_file_underflow, _IO_file_write, _IO_file_xsputn): Added to GLIBC_2.1. * libio/fileops.c (_IO_do_write, _IO_file_attach, _IO_file_close_it, _IO_file_finish, _IO_file_fopen, _IO_file_init, _IO_file_overflow, _IO_file_seekoff, _IO_file_setbuf, _IO_file_sync, _IO_file_underflow, _IO_file_write, _IO_file_xsputn): Change the prefix to "_IO_new_". Added to GLIBC_2.1. * libio/libioP.h (_IO_do_write, _IO_file_attach, _IO_file_close_it, _IO_file_finish, _IO_file_fopen, _IO_file_init, _IO_file_overflow, _IO_file_seekoff, _IO_file_setbuf, _IO_file_sync, _IO_file_underflow, _IO_file_write, _IO_file_xsputn): Add prototypes for the prefix "_IO_new_". * libio/oldfileops.c (_IO_do_write, _IO_file_attach, _IO_file_close_it, _IO_file_finish, _IO_file_fopen, _IO_file_init, _IO_file_overflow, _IO_file_seekoff, _IO_file_setbuf, _IO_file_sync, _IO_file_underflow, _IO_file_write, _IO_file_xsputn): Added to GLIBC_2.0. * csu/initfini.c: Return to .text before __gmon_start__. * elf/elf.h (EM_FAKE_ALPHA): Rename from EM_OLD_ALPHA. (STO_MIPS_*): Rename from STO_*. (STB_MIPS_SPLIT_COMMON): Rename from STB_SPLIT_COMMON. (STO_ALPHA_NOPV, STO_ALPHA_STD_GPLOAD): New. * math/atest-exp.c (mpn_bitsize): Fix bit location calculation. (main): e3s is negative on zero. * math/atest-exp2.c: Likewise. 1998-08-23 Andreas Jaeger <aj@arthur.rhein-neckar.de> * Makerules (install): Add comment about absolute paths.
This commit is contained in:
@ -18,16 +18,21 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <execinfo.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* This file defines macros to access the content of the sigcontext element
|
||||
passed up by the signal handler. */
|
||||
#include <sigcontextinfo.h>
|
||||
|
||||
/* Get code to possibly dump the content of all registers. */
|
||||
#include <register-dump.h>
|
||||
|
||||
/* This is a global variable set at program start time. It marks the
|
||||
highest used stack address. */
|
||||
extern void *__libc_stack_end;
|
||||
@ -76,6 +81,8 @@ catch_segfault (int signal, SIGCONTEXT ctx)
|
||||
int fd;
|
||||
void **arr;
|
||||
size_t cnt;
|
||||
struct sigaction sa;
|
||||
const char *sigstring;
|
||||
|
||||
/* This is the name of the file we are writing to. If none is given
|
||||
or we cannot write to this file write to stderr. */
|
||||
@ -88,9 +95,17 @@ catch_segfault (int signal, SIGCONTEXT ctx)
|
||||
fd = 2;
|
||||
}
|
||||
|
||||
#define WRITE_STRING(s) write (fd, s, sizeof (s) - 1)
|
||||
WRITE_STRING ("*** Segmentation Fault\n");
|
||||
WRITE_STRING ("Backtrace:\n");
|
||||
#define WRITE_STRING(s) write (fd, s, strlen (s))
|
||||
WRITE_STRING ("*** ");
|
||||
sigstring = strsignal (signal);
|
||||
WRITE_STRING (sigstring);
|
||||
WRITE_STRING ("\n");
|
||||
|
||||
#ifdef REGISTER_DUMP
|
||||
REGISTER_DUMP;
|
||||
#endif
|
||||
|
||||
WRITE_STRING ("\nBacktrace:\n");
|
||||
|
||||
top_frame = GET_FRAME (ctx);
|
||||
top_stack = GET_STACK (ctx);
|
||||
@ -124,8 +139,12 @@ catch_segfault (int signal, SIGCONTEXT ctx)
|
||||
/* Now generate nicely formatted output. */
|
||||
__backtrace_symbols_fd (arr, cnt, fd);
|
||||
|
||||
/* Nothing else to do. */
|
||||
_exit (128 + SIGSEGV);
|
||||
/* Pass on the signal (so that a core file is produced). */
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sigaction (signal, &sa, NULL);
|
||||
raise (signal);
|
||||
}
|
||||
|
||||
|
||||
@ -134,12 +153,36 @@ __attribute__ ((constructor))
|
||||
install_handler (void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
const char *sigs = getenv ("SEGFAULT_SIGNALS");
|
||||
|
||||
sa.sa_handler = (void *) catch_segfault;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
|
||||
sigaction (SIGSEGV, &sa, NULL);
|
||||
if (sigs == NULL)
|
||||
sigaction (SIGSEGV, &sa, NULL);
|
||||
else if (sigs[0] == '\0')
|
||||
/* Do not do anything. */
|
||||
return;
|
||||
else
|
||||
{
|
||||
const char *where;
|
||||
int all = __strcasecmp (sigs, "all");
|
||||
|
||||
#define INSTALL_FOR_SIG(sig, name) \
|
||||
where = __strcasestr (sigs, name); \
|
||||
if (all || (where != NULL \
|
||||
&& (where == sigs || !isalnum (where[-1])) \
|
||||
&& !isalnum (where[sizeof (name) - 1]))) \
|
||||
sigaction (sig, &sa, NULL);
|
||||
|
||||
INSTALL_FOR_SIG (SIGSEGV, "segv");
|
||||
INSTALL_FOR_SIG (SIGILL, "ill");
|
||||
INSTALL_FOR_SIG (SIGBUS, "bus");
|
||||
INSTALL_FOR_SIG (SIGSTKFLT, "stkflt");
|
||||
INSTALL_FOR_SIG (SIGABRT, "abrt");
|
||||
INSTALL_FOR_SIG (SIGFPE, "fpe");
|
||||
}
|
||||
|
||||
/* Maybe we are expected to use an alternative stack. */
|
||||
if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
|
||||
|
Reference in New Issue
Block a user