diff options
| -rw-r--r-- | ChangeLog | 123 | ||||
| -rw-r--r-- | elf/ldd.bash.in | 81 | ||||
| -rw-r--r-- | linuxthreads/ChangeLog | 10 | ||||
| -rw-r--r-- | linuxthreads/spinlock.c | 3 | ||||
| -rw-r--r-- | linuxthreads/sysdeps/powerpc/pt-machine.h | 31 | ||||
| -rw-r--r-- | sysdeps/generic/register-dump.h | 21 | ||||
| -rw-r--r-- | sysdeps/generic/segfault.c | 55 | ||||
| -rw-r--r-- | sysdeps/i386/register-dump.h | 256 | ||||
| -rw-r--r-- | sysdeps/powerpc/register-dump.h | 73 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/i386/profil-counter.h | 5 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/ldd-rewrite.sed | 2 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/chown.c | 131 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/clone.S | 78 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/lchown.S | 35 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/profil-counter.h | 36 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h | 24 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/syscalls.list | 4 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/sys/mount.h | 6 |
18 files changed, 762 insertions, 212 deletions
@@ -1,4 +1,47 @@ -Mon Aug 24 10:37:38 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> +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> * sysdeps/unix/sysv/linux/m68k/Makefile (sysdep_headers): Add sys/reg.h. @@ -17,53 +60,53 @@ Mon Aug 24 10:37:38 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund. Likewise. 1998-08-17 H.J. Lu <hjl@gnu.org> - - * 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. - + + * 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. + 1998-08-23 Richard Henderson <rth@cygnus.com> * Makeconfig (LDFLAGS): Remove. - * csu/initfini.c: Return to .text before __gmon_start__. + * 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. + * 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. + * math/atest-exp.c (mpn_bitsize): Fix bit location calculation. + (main): e3s is negative on zero. + * math/atest-exp2.c: Likewise. * math/atest-sincos.c: Likewise. -1998-08-23 Andreas Jaeger <aj@arthur.rhein-neckar.de> - - * Makerules (install): Add comment about absolute paths. - +1998-08-23 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * Makerules (install): Add comment about absolute paths. + 1998-08-23 Ulrich Drepper <drepper@cygnus.com> * libio/vsnprintf.c (_IO_vsnprintf): Set first byte of destination diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in index f6ffa6b4e8..aeaf695aac 100644 --- a/elf/ldd.bash.in +++ b/elf/ldd.bash.in @@ -102,33 +102,43 @@ case $# in exit 1 ;; 1) + single_file=t + ;; +*) + single_file=f + ;; +esac + +result=0 +for file do # We don't list the file name when there is only one. - case "$1" in - */*) file="$1" + test $single_file = t || echo "${file}:" + case $file in + */*) : ;; - *) file="./$1" + *) file=./$file ;; esac if test ! -f "$file"; then - echo "ldd: ${file}:" $"no such file" - exit 1 + echo "ldd: ${file}:" $"No such file or directory" >&2 + result=1 elif test -r "$file"; then - test -x "$file" || - echo 'ldd:' $"\ + test -x "$file" || echo 'ldd:' $"\ warning: you do not have execution permission for" "\`$file'" >&2 verify_out=`${RTLD} --verify "$file"` case $? in 0) - eval $add_env exec '"$file"' || exit 1 + eval $add_env '"$file"' || result=1 ;; 1) # This can be a non-ELF binary or no binary at all. - nonelf $file || - echo $" not a dynamic executable" - exit 1 + nonelf "$file" || { + echo $" not a dynamic executable" + result=1 + } ;; 2) - eval $add_env exec \${RTLD} '"$file"' || exit 1 + eval $add_env \${RTLD} '"$file"' || result=1 ;; *) echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($?)" >&2 @@ -137,52 +147,9 @@ warning: you do not have execution permission for" "\`$file'" >&2 esac else echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2 - exit 1 + result=1 fi - exit - ;; -*) - result=0 - for file; do - echo "${file}:" - case "$file" in - */*) : - ;; - *) file="./$file" - ;; - esac - if test ! -f "$file"; then - echo "ldd: ${file}:" $"no such file" - result=1 - elif test -r "$file"; then - test -x "$file" || echo 'ldd:' $"\ -warning: you do not have execution permission for" "\`$file'" >&2 - verify_out=`${RTLD} --verify "$file"` - case $? in - 0) - eval $add_env '"$file"' || result=1 - ;; - 1) - # This can be a non-ELF binary or no binary at all. - nonelf $file || { - echo $" not a dynamic executable" - result=1 - } - ;; - 2) - eval $add_env ${RTLD} '"$file"' || result=1 - ;; - *) - echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($?)" >&2 - exit 1 - ;; - esac - else - echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2 - result=1 - fi - done -esac +done exit $result # Local Variables: diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index c89fa758a3..5b4dcbd64a 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,13 @@ +1998-08-24 Geoff Keating <geoffk@ozemail.com.au> + + * spinlock.c (__pthread_lock): Reset p_nextwaiting to NULL if it + turned out that we didn't need to queue after all. + +1998-08-22 Geoff Keating <geoffk@ozemail.com.au> + + * sysdeps/powerpc/pt-machine.h: Remove testandset, it's not used + and wastes space; correct types. + 1998-08-08 11:18 H.J. Lu <hjl@gnu.org> * signals.c (sigaction): Handle NULL argument. diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c index 2546e2a6e0..8a8d3bfb84 100644 --- a/linuxthreads/spinlock.c +++ b/linuxthreads/spinlock.c @@ -47,9 +47,10 @@ void __pthread_lock(struct _pthread_fastlock * lock) newstatus = 1; } else { self = thread_self(); - self->p_nextwaiting = (pthread_descr) oldstatus; newstatus = (long) self; } + if (self != NULL) + self->p_nextwaiting = (pthread_descr) oldstatus; } while(! compare_and_swap(&lock->status, oldstatus, newstatus, &lock->spinlock)); if (oldstatus != 0) suspend(self); diff --git a/linuxthreads/sysdeps/powerpc/pt-machine.h b/linuxthreads/sysdeps/powerpc/pt-machine.h index a52af8a7eb..7829c779e6 100644 --- a/linuxthreads/sysdeps/powerpc/pt-machine.h +++ b/linuxthreads/sysdeps/powerpc/pt-machine.h @@ -2,7 +2,6 @@ powerpc version. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Richard Henderson <rth@tamu.edu>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -31,34 +30,6 @@ #define sync() __asm__ __volatile__ ("sync") #endif -/* Spinlock implementation; required. */ -#if BROKEN_PPC_ASM_CR0 -static -#else -extern inline -#endif -int -testandset (int *spinlock) -{ - int ret; - - sync(); - __asm__ __volatile__( - "0: lwarx %0,0,%1 ;" - " cmpwi %0,0;" - " bne 1f;" - " stwcx. %2,0,%1;" - " bne- 0b;" - "1: " - : "=&r"(ret) - : "r"(spinlock), "r"(1) - : "cr0", "memory"); - sync(); - - return ret != 0; -} - - /* Get some notion of the current stack. Need not be exactly the top of the stack, just something somewhere in the current frame. */ #define CURRENT_STACK_FRAME stack_pointer @@ -74,7 +45,7 @@ static extern inline #endif int -__compare_and_swap (int *p, int oldval, int newval) +__compare_and_swap (long *p, long oldval, long newval) { int ret; diff --git a/sysdeps/generic/register-dump.h b/sysdeps/generic/register-dump.h new file mode 100644 index 0000000000..42c222c2ed --- /dev/null +++ b/sysdeps/generic/register-dump.h @@ -0,0 +1,21 @@ +/* Dump registers. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* In general we cannot do anything. */ diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c index 6504123e18..090f91a657 100644 --- a/sysdeps/generic/segfault.c +++ b/sysdeps/generic/segfault.c @@ -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) diff --git a/sysdeps/i386/register-dump.h b/sysdeps/i386/register-dump.h new file mode 100644 index 0000000000..34501fe1be --- /dev/null +++ b/sysdeps/i386/register-dump.h @@ -0,0 +1,256 @@ +/* Dump registers. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <sys/uio.h> +#include <stdio-common/_itoa.h> + +/* We will print the register dump in this format: + + EAX: XXXXXXXX EBX: XXXXXXXX ECX: XXXXXXXX EDX: XXXXXXXX + ESI: XXXXXXXX EDI: XXXXXXXX EBP: XXXXXXXX ESP: XXXXXXXX + + EIP: XXXXXXXX EFLAGS: XXXXXXXX + + CS: XXXX DS: XXXX ES: XXXX FS: XXXX GS: XXXX SS: XXXX + + Trap: XXXXXXXX Error: XXXXXXXX OldMask: XXXXXXXX + ESP/SIGNAL: XXXXXXXX CR2: XXXXXXXX + + FPUCW: XXXXXXXX FPUSW: XXXXXXXX TAG: XXXXXXXX + IPOFF: XXXXXXXX CSSEL: XXXX DATAOFF: XXXXXXXX DATASEL: XXXX + + ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX + ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX + ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX + ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX + + */ + +static void +hexvalue (unsigned long int value, char *buf, size_t len) +{ + char *cp = _itoa_word (value, buf + len, 16, 0); + while (cp > buf) + *--cp = '0'; +} + +static void +register_dump (int fd, struct sigcontext *ctx) +{ + char regs[21][8]; + char fpregs[31][8]; + struct iovec iov[97]; + size_t nr = 0; + +#define ADD_STRING(str) \ + iov[nr].iov_base = (char *) str; \ + iov[nr].iov_len = strlen (str); \ + ++nr +#define ADD_MEM(str, len) \ + iov[nr].iov_base = str; \ + iov[nr].iov_len = len; \ + ++nr + + /* Generate strings of register contents. */ + hexvalue (ctx->eax, regs[0], 8); + hexvalue (ctx->ebx, regs[1], 8); + hexvalue (ctx->ecx, regs[2], 8); + hexvalue (ctx->edx, regs[3], 8); + hexvalue (ctx->esi, regs[4], 8); + hexvalue (ctx->edi, regs[5], 8); + hexvalue (ctx->ebp, regs[6], 8); + hexvalue (ctx->esp, regs[7], 8); + hexvalue (ctx->eip, regs[8], 8); + hexvalue (ctx->eflags, regs[9], 8); + hexvalue (ctx->cs, regs[10], 4); + hexvalue (ctx->ds, regs[11], 4); + hexvalue (ctx->es, regs[12], 4); < |
