Forráskód Böngészése

Several pthreads updates. Enable linuxthreads_db. Several fixes
related to thread local storage.
-Erik

Eric Andersen 22 éve
szülő
commit
7711a9b8e8
45 módosított fájl, 427 hozzáadás és 424 törlés
  1. 1 5
      libpthread/Makefile
  2. 2 2
      libpthread/linuxthreads/Makefile
  3. 13 0
      libpthread/linuxthreads/cancel.c
  4. 0 33
      libpthread/linuxthreads/no-tsd.c
  5. 3 2
      libpthread/linuxthreads/specific.c
  6. 5 4
      libpthread/linuxthreads/sysdeps/pthread/bits/libc-tsd.h
  7. 10 7
      libpthread/linuxthreads_db/Makefile
  8. 8 8
      libpthread/linuxthreads_db/td_init.c
  9. 8 8
      libpthread/linuxthreads_db/td_log.c
  10. 8 8
      libpthread/linuxthreads_db/td_ta_clear_event.c
  11. 8 8
      libpthread/linuxthreads_db/td_ta_delete.c
  12. 8 8
      libpthread/linuxthreads_db/td_ta_enable_stats.c
  13. 15 17
      libpthread/linuxthreads_db/td_ta_event_addr.c
  14. 8 8
      libpthread/linuxthreads_db/td_ta_event_getmsg.c
  15. 10 12
      libpthread/linuxthreads_db/td_ta_get_nthreads.c
  16. 8 8
      libpthread/linuxthreads_db/td_ta_get_ph.c
  17. 8 8
      libpthread/linuxthreads_db/td_ta_get_stats.c
  18. 12 9
      libpthread/linuxthreads_db/td_ta_map_id2thr.c
  19. 8 8
      libpthread/linuxthreads_db/td_ta_map_lwp2thr.c
  20. 18 40
      libpthread/linuxthreads_db/td_ta_new.c
  21. 8 8
      libpthread/linuxthreads_db/td_ta_reset_stats.c
  22. 8 8
      libpthread/linuxthreads_db/td_ta_set_event.c
  23. 8 8
      libpthread/linuxthreads_db/td_ta_setconcurrency.c
  24. 10 11
      libpthread/linuxthreads_db/td_ta_thr_iter.c
  25. 10 11
      libpthread/linuxthreads_db/td_ta_tsd_iter.c
  26. 8 8
      libpthread/linuxthreads_db/td_thr_clear_event.c
  27. 8 8
      libpthread/linuxthreads_db/td_thr_dbresume.c
  28. 8 8
      libpthread/linuxthreads_db/td_thr_dbsuspend.c
  29. 8 8
      libpthread/linuxthreads_db/td_thr_event_enable.c
  30. 8 8
      libpthread/linuxthreads_db/td_thr_event_getmsg.c
  31. 16 15
      libpthread/linuxthreads_db/td_thr_get_info.c
  32. 16 11
      libpthread/linuxthreads_db/td_thr_getfpregs.c
  33. 16 11
      libpthread/linuxthreads_db/td_thr_getgregs.c
  34. 8 8
      libpthread/linuxthreads_db/td_thr_getxregs.c
  35. 8 8
      libpthread/linuxthreads_db/td_thr_getxregsize.c
  36. 8 8
      libpthread/linuxthreads_db/td_thr_set_event.c
  37. 16 12
      libpthread/linuxthreads_db/td_thr_setfpregs.c
  38. 16 12
      libpthread/linuxthreads_db/td_thr_setgregs.c
  39. 8 8
      libpthread/linuxthreads_db/td_thr_setprio.c
  40. 8 8
      libpthread/linuxthreads_db/td_thr_setsigpending.c
  41. 8 8
      libpthread/linuxthreads_db/td_thr_setxregs.c
  42. 8 8
      libpthread/linuxthreads_db/td_thr_sigsetmask.c
  43. 8 8
      libpthread/linuxthreads_db/td_thr_tsd.c
  44. 16 10
      libpthread/linuxthreads_db/td_thr_validate.c
  45. 22 0
      libpthread/linuxthreads_db/thread_dbP.h

+ 1 - 5
libpthread/Makefile

@@ -30,11 +30,7 @@ LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SU
 
 DIRS=
 ifeq ($(strip $(INCLUDE_THREADS)),true)
-	DIRS+=linuxthreads
-# For now, don't build the debug library since it doesn't work yet anyways...
-#ifeq ($(strip $(DODEBUG)),true)
-#	DIRS+=linuxthreads_db
-#endif
+	DIRS+=linuxthreads linuxthreads_db
 endif
 
 ALL_SUBDIRS = linuxthreads linuxthreads_db

+ 2 - 2
libpthread/linuxthreads/Makefile

@@ -37,12 +37,12 @@ SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \
             -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
             -I$(PTDIR)sysdeps \
             -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
+CFLAGS += $(SYSDEPINC)
 
 CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
 	mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \
 	ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c \
-	wrapsyscall.c #weaks.c no-tsd.c
+	wrapsyscall.c #weaks.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
 

+ 13 - 0
libpthread/linuxthreads/cancel.c

@@ -14,11 +14,18 @@
 
 /* Thread cancellation */
 
+#define __FORCE_GLIBC
+#include <features.h>
 #include <errno.h>
 #include "pthread.h"
 #include "internals.h"
 #include "spinlock.h"
 #include "restart.h"
+#ifdef __UCLIBC_HAS_RPC__
+#include <rpc/rpc.h>
+extern void __rpc_thread_destroy(void);
+#endif
+
 
 int pthread_setcancelstate(int state, int * oldstate)
 {
@@ -160,6 +167,12 @@ void __pthread_perform_cleanup(void)
   struct _pthread_cleanup_buffer * c;
   for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
     c->__routine(c->__arg);
+
+#ifdef __UCLIBC_HAS_RPC__
+  /* And the TSD which needs special help.  */
+  if (THREAD_GETMEM(self, p_libc_specific[_LIBC_TSD_KEY_RPC_VARS]) != NULL)
+      __rpc_thread_destroy ();
+#endif
 }
 
 #ifndef PIC

+ 0 - 33
libpthread/linuxthreads/no-tsd.c

@@ -1,33 +0,0 @@
-/* libc-internal interface for thread-specific data.
-   Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   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 <bits/libc-tsd.h>
-
-/* This file provides uinitialized (common) definitions for the
-   hooks used internally by libc to access thread-specific data.
-
-   When -lpthread is used, it provides initialized definitions for these
-   variables (in specific.c), which override these uninitialized definitions.
-
-   If -lpthread is not used, these uninitialized variables default to zero,
-   which the __libc_tsd_* macros check for.   */
-
-void *(*__libc_internal_tsd_get) __P ((enum __libc_tsd_key_t));
-int (*__libc_internal_tsd_set) __P ((enum __libc_tsd_key_t,
-				     __const void *));

+ 3 - 2
libpthread/linuxthreads/specific.c

@@ -166,7 +166,7 @@ libc_internal_tsd_set(enum __libc_tsd_key_t key, const void * pointer)
   return 0;
 }
 int (*__libc_internal_tsd_set)(enum __libc_tsd_key_t key, const void * pointer)
-     = libc_internal_tsd_set;
+    = libc_internal_tsd_set;
 
 static void *
 libc_internal_tsd_get(enum __libc_tsd_key_t key)
@@ -176,4 +176,5 @@ libc_internal_tsd_get(enum __libc_tsd_key_t key)
   return THREAD_GETMEM_NC(self, p_libc_specific[key]);
 }
 void * (*__libc_internal_tsd_get)(enum __libc_tsd_key_t key)
-     = libc_internal_tsd_get;
+    = libc_internal_tsd_get;
+

+ 5 - 4
libpthread/linuxthreads/sysdeps/pthread/bits/libc-tsd.h

@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  LinuxThreads version.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,11 +25,12 @@
 /* Fast thread-specific data internal to libc.  */
 enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
 			_LIBC_TSD_KEY_DL_ERROR,
+			_LIBC_TSD_KEY_RPC_VARS,
 			_LIBC_TSD_KEY_N };
 
-extern void *(*__libc_internal_tsd_get) __P ((enum __libc_tsd_key_t));
-extern int (*__libc_internal_tsd_set) __P ((enum __libc_tsd_key_t,
-					    __const void *));
+extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
+extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
+				       __const void *)  __THROW;
 
 #define __libc_tsd_define(CLASS, KEY)	CLASS void *__libc_tsd_##KEY##_data;
 #define __libc_tsd_get(KEY) \

+ 10 - 7
libpthread/linuxthreads_db/Makefile

@@ -21,8 +21,12 @@ TOPDIR=../../
 include $(TOPDIR)Rules.mak
 
 #Adjust the soname version to avoid namespace collisions with glibc's libpthread
-PT_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
-LIBPTHREAD=../libpthread.a
+LIBTHREAD_DB:=../libthread_db.a
+ifeq ($(strip $(TARGET_ARCH)),sparc)
+SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
+else
+SYSDEPS_DIR:=$(TARGET_ARCH)
+endif
 
 # set up system dependencies include dirs (NOTE: order matters!)
 PTDIR = $(TOPDIR)libpthread/linuxthreads/
@@ -33,7 +37,7 @@ SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \
             -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
             -I$(PTDIR)sysdeps \
             -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(PT_VERSION)\""
+CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
 
 CSRC=td_init.c td_log.c td_ta_clear_event.c td_ta_delete.c \
 	td_ta_enable_stats.c td_ta_event_addr.c td_ta_event_getmsg.c \
@@ -50,12 +54,12 @@ CSRC=td_init.c td_log.c td_ta_clear_event.c td_ta_delete.c \
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
 
-all: $(OBJS) $(LIBPTHREAD)
+all: $(OBJS) $(LIBTHREAD_DB)
 
-$(LIBPTHREAD): ar-target
+$(LIBTHREAD_DB): ar-target
 
 ar-target: $(OBJS)
-	$(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
+	$(AR) $(ARFLAGS) $(LIBTHREAD_DB) $(OBJS)
 
 $(COBJS): %.o : %.c
 	$(CC) $(CFLAGS) -c $< -o $@
@@ -65,4 +69,3 @@ clean:
 	rm -f *.[oa] *~ core
 
 
-

+ 8 - 8
libpthread/linuxthreads_db/td_init.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_log.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_clear_event.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_delete.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stdlib.h>
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_enable_stats.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 15 - 17
libpthread/linuxthreads_db/td_ta_event_addr.c

@@ -1,24 +1,22 @@
 /* Get event address.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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 <gnu/lib-names.h>
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -27,7 +25,7 @@ td_err_e
 td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
 {
   td_err_e res = TD_NOEVENT;
-  const char *symbol = NULL;
+  int idx = -1;
 
   LOG (__FUNCTION__);
 
@@ -38,15 +36,15 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
   switch (event)
     {
     case TD_CREATE:
-      symbol = "__linuxthreads_create_event";
+      idx = LINUXTHREADS_CREATE_EVENT;
       break;
 
     case TD_DEATH:
-      symbol = "__linuxthreads_death_event";
+      idx = LINUXTHREADS_DEATH_EVENT;
       break;
 
     case TD_REAP:
-      symbol = "__linuxthreads_reap_event";
+      idx = LINUXTHREADS_REAP_EVENT;
       break;
 
     default:
@@ -55,11 +53,11 @@ td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
     }
 
   /* Now get the address.  */
-  if (symbol != NULL)
+  if (idx != -1)
     {
       psaddr_t taddr;
 
-      if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, symbol, &taddr) == PS_OK)
+      if (td_lookup (ta->ph, idx, &taddr) == PS_OK)
 	{
 	  /* Success, we got the address.  */
 	  addr->type = NOTIFY_BPT;

+ 8 - 8
libpthread/linuxthreads_db/td_ta_event_getmsg.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 #include <string.h>

+ 10 - 12
libpthread/linuxthreads_db/td_ta_get_nthreads.c

@@ -1,25 +1,24 @@
 /* Get the number of threads in the process.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
-//#include <gnu/lib-names.h>
 
 td_err_e
 td_ta_get_nthreads (const td_thragent_t *ta, int *np)
@@ -33,8 +32,7 @@ td_ta_get_nthreads (const td_thragent_t *ta, int *np)
     return TD_BADTA;
 
   /* Access the variable `__pthread_handles_num'.  */
-  if (ps_pglobal_lookup (ta->ph, LIBPTHREAD_SO, "__pthread_handles_num",
-		         &addr) != PS_OK)
+  if (td_lookup (ta->ph, PTHREAD_HANDLES_NUM, &addr) != PS_OK)
      return TD_ERR;	/* XXX Other error value?  */
 
   if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK)

+ 8 - 8
libpthread/linuxthreads_db/td_ta_get_ph.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_get_stats.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 12 - 9
libpthread/linuxthreads_db/td_ta_map_id2thr.c

@@ -1,22 +1,22 @@
 /* Map thread ID to thread handle.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -55,6 +55,9 @@ td_ta_map_id2thr (const td_thragent_t *ta, pthread_t pt, td_thrhandle_t *th)
   if (pds.p_tid != pt)
     return TD_BADTH;
 
+  if (pds.p_terminated != 0)
+    return TD_NOTHR;
+
   /* Create the `td_thrhandle_t' object.  */
   th->th_ta_p = (td_thragent_t *) ta;
   th->th_unique = phc.h_descr;

+ 8 - 8
libpthread/linuxthreads_db/td_ta_map_lwp2thr.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 18 - 40
libpthread/linuxthreads_db/td_ta_new.c

@@ -1,26 +1,25 @@
 /* Attach to target process.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 #include <stdlib.h>
-//#include <gnu/lib-names.h>
 
 #include "thread_dbP.h"
 
@@ -41,8 +40,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
   /* Get the global event mask.  This is one of the variables which
      are new in the thread library to enable debugging.  If it is
      not available we cannot debug.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__pthread_threads_events", &addr) != PS_OK)
+  if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK)
     return TD_NOLIBTHREAD;
 
   /* Fill in the appropriate information.  */
@@ -59,9 +57,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
 
   /* Get the pointer to the variable pointing to the thread descriptor
      with the last event.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__pthread_last_event",
-			 &(*ta)->pthread_last_event) != PS_OK)
+  if (td_lookup (ps, PTHREAD_LAST_EVENT, &(*ta)->pthread_last_event) != PS_OK)
     {
     free_return:
       free (*ta);
@@ -70,21 +66,18 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
 
   /* Get the pointer to the variable containing the number of active
      threads.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__pthread_handles_num",
-			 &(*ta)->pthread_handles_num) != PS_OK)
+  if (td_lookup (ps, PTHREAD_HANDLES_NUM, &(*ta)->pthread_handles_num)
+      != PS_OK)
     goto free_return;
 
   /* See whether the library contains the necessary symbols.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "__pthread_handles",
-		         &addr) != PS_OK)
+  if (td_lookup (ps, PTHREAD_HANDLES, &addr) != PS_OK)
     goto free_return;
 
   (*ta)->handles = (struct pthread_handle_struct *) addr;
 
 
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO, "pthread_keys",
-		         &addr) != PS_OK)
+  if (td_lookup (ps, PTHREAD_KEYS, &addr) != PS_OK)
     goto free_return;
 
   /* Cast to the right type.  */
@@ -93,8 +86,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
   /* Find out about the maximum number of threads.  Old implementations
      don't provide this information.  In this case we assume that the
      debug  library is compiled with the same values.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__linuxthreads_pthread_threads_max", &addr) != PS_OK)
+  if (td_lookup (ps, LINUXTHREADS_PTHREAD_THREADS_MAX, &addr) != PS_OK)
     (*ta)->pthread_threads_max = PTHREAD_THREADS_MAX;
   else
     {
@@ -104,8 +96,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
     }
 
   /* Similar for the maximum number of thread local data keys.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__linuxthreads_pthread_keys_max", &addr) != PS_OK)
+  if (td_lookup (ps, LINUXTHREADS_PTHREAD_KEYS_MAX, &addr) != PS_OK)
     (*ta)->pthread_keys_max = PTHREAD_KEYS_MAX;
   else
     {
@@ -115,9 +106,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
     }
 
   /* And for the size of the second level arrays for the keys.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__linuxthreads_pthread_sizeof_descr", &addr)
-      != PS_OK)
+  if (td_lookup (ps, LINUXTHREADS_PTHREAD_SIZEOF_DESCR, &addr) != PS_OK)
     (*ta)->sizeof_descr = sizeof (struct _pthread_descr_struct);
   else
     {
@@ -125,17 +114,6 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
 	goto free_return;
     }
 
-  /* Similar for the maximum number of thread local data keys.  */
-  if (ps_pglobal_lookup (ps, LIBPTHREAD_SO,
-			 "__linuxthreads_pthread_keys_max", &addr) != PS_OK)
-    (*ta)->pthread_keys_max = PTHREAD_KEYS_MAX;
-  else
-    {
-      if (ps_pdread (ps, addr, &(*ta)->pthread_keys_max, sizeof (int))
-	  != PS_OK)
-	goto free_return;
-    }
-
   /* Now add the new agent descriptor to the list.  */
   elemp = (struct agent_list *) malloc (sizeof (struct agent_list));
   if (elemp == NULL)

+ 8 - 8
libpthread/linuxthreads_db/td_ta_reset_stats.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_set_event.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_ta_setconcurrency.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 10 - 11
libpthread/linuxthreads_db/td_ta_thr_iter.c

@@ -1,26 +1,25 @@
 /* Iterate over a process's threads.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#include <stdlib.h>
 #include "thread_dbP.h"
-
+#include <alloca.h>
 
 static int
 handle_descr (const td_thragent_t *ta, td_thr_iter_f *callback,

+ 10 - 11
libpthread/linuxthreads_db/td_ta_tsd_iter.c

@@ -1,26 +1,25 @@
 /* Iterate over a process's thread-specific data.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#include <stdlib.h>
 #include "thread_dbP.h"
-
+#include <alloca.h>
 
 td_err_e
 td_ta_tsd_iter (const td_thragent_t *ta, td_key_iter_f *callback,

+ 8 - 8
libpthread/linuxthreads_db/td_thr_clear_event.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_dbresume.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_dbsuspend.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_event_enable.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_event_getmsg.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 #include <string.h>

+ 16 - 15
libpthread/linuxthreads_db/td_thr_get_info.c

@@ -1,22 +1,22 @@
 /* Get thread information.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 #include <string.h>
@@ -46,7 +46,7 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
     {
       infop->ti_tid = th->th_ta_p->pthread_threads_max * 2 + 1;
       infop->ti_type = TD_THR_SYSTEM;
-      infop->ti_state = TD_THR_RUN;
+      infop->ti_state = TD_THR_ACTIVE;
     }
   else
     {
@@ -54,13 +54,14 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
       infop->ti_tls = (char *) pds.p_specific;
       infop->ti_pri = pds.p_priority;
       infop->ti_type = TD_THR_USER;
-
-      if (pds.p_exited)
-	/* This should not happen.  */
+      
+      if (! pds.p_terminated)
+	/* XXX For now there is no way to get more information.  */
+	infop->ti_state = TD_THR_ACTIVE;
+      else if (! pds.p_detached)
 	infop->ti_state = TD_THR_ZOMBIE;
       else
-	/* XXX For now there is no way to get more information.  */
-	infop->ti_state = TD_THR_RUN;
+	infop->ti_state = TD_THR_UNKNOWN;
     }
 
   /* Initialization which are the same in both cases.  */

+ 16 - 11
libpthread/linuxthreads_db/td_thr_getfpregs.c

@@ -1,22 +1,22 @@
 /* Get a thread's floating-point register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -37,8 +37,13 @@ td_thr_getfpregs (const td_thrhandle_t *th, prfpregset_t *regset)
   if (pds.p_terminated)
     memset (regset, '\0', sizeof (*regset));
   /* Otherwise get the register content through the callback.  */
-  else if (ps_lgetfpregs (th->th_ta_p->ph, pds.p_pid, regset) != PS_OK)
-    return TD_ERR;
+  else
+    {
+      pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+      if (ps_lgetfpregs (th->th_ta_p->ph, pid, regset) != PS_OK)
+	return TD_ERR;
+    }
 
   return TD_OK;
 }

+ 16 - 11
libpthread/linuxthreads_db/td_thr_getgregs.c

@@ -1,22 +1,22 @@
 /* Get a thread's general register set.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -37,8 +37,13 @@ td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
   if (pds.p_terminated)
     memset (gregs, '\0', sizeof (prgregset_t));
   /* Otherwise get the register content through the callback.  */
-  else if (ps_lgetregs (th->th_ta_p->ph, pds.p_pid, gregs) != PS_OK)
-    return TD_ERR;
+  else
+    {
+      pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+      if (ps_lgetregs (th->th_ta_p->ph, pid, gregs) != PS_OK)
+	return TD_ERR;
+    }
 
   return TD_OK;
 }

+ 8 - 8
libpthread/linuxthreads_db/td_thr_getxregs.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_getxregsize.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_set_event.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 

+ 16 - 12
libpthread/linuxthreads_db/td_thr_setfpregs.c

@@ -1,22 +1,22 @@
 /* Set a thread's floating-point register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -34,9 +34,13 @@ td_thr_setfpregs (const td_thrhandle_t *th, const prfpregset_t *fpregs)
     return TD_ERR;
 
   /* Only set the registers if the thread hasn't yet terminated.  */
-  if (pds.p_terminated == 0
-      && ps_lsetfpregs (th->th_ta_p->ph, pds.p_pid, fpregs) != PS_OK)
-    return TD_ERR;
+  if (pds.p_terminated == 0)
+    {
+      pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+      if (ps_lsetfpregs (th->th_ta_p->ph, pid, fpregs) != PS_OK)
+	return TD_ERR;
+    }
 
   return TD_OK;
 }

+ 16 - 12
libpthread/linuxthreads_db/td_thr_setgregs.c

@@ -1,22 +1,22 @@
 /* Set a thread's general register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -34,9 +34,13 @@ td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs)
     return TD_ERR;
 
   /* Only set the registers if the thread hasn't yet terminated.  */
-  if (pds.p_terminated == 0
-      && ps_lsetregs (th->th_ta_p->ph, pds.p_pid, gregs) != PS_OK)
-    return TD_ERR;
+  if (pds.p_terminated == 0)
+    {
+      pid_t pid = pds.p_pid ?: ps_getpid (th->th_ta_p->ph);
+
+      if (ps_lsetregs (th->th_ta_p->ph, pid, gregs) != PS_OK)
+	return TD_ERR;
+    }
 
   return TD_OK;
 }

+ 8 - 8
libpthread/linuxthreads_db/td_thr_setprio.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_setsigpending.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_setxregs.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_sigsetmask.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 8 - 8
libpthread/linuxthreads_db/td_thr_tsd.c

@@ -4,19 +4,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 

+ 16 - 10
libpthread/linuxthreads_db/td_thr_validate.c

@@ -1,22 +1,22 @@
 /* Validate a thread handle.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include "thread_dbP.h"
 
@@ -41,9 +41,15 @@ td_thr_validate (const td_thrhandle_t *th)
 
       if (phc.h_descr != NULL && phc.h_descr == th->th_unique)
 	{
+	  struct _pthread_descr_struct pds;
+
+	  if (ps_pdread (th->th_ta_p->ph, phc.h_descr, &pds,
+			 th->th_ta_p->sizeof_descr) != PS_OK)
+	    return TD_ERR;	/* XXX Other error value?  */
+
 	  /* XXX There should be another test using the TID but this is
 	     currently not available.  */
-	  return TD_OK;
+	  return pds.p_terminated != 0 ? TD_NOTHR : TD_OK;
 	}
     }
 

+ 22 - 0
libpthread/linuxthreads_db/thread_dbP.h

@@ -8,6 +8,24 @@
 #include "../linuxthreads/internals.h"
 
 
+/* Indeces for the symbol names.  */
+enum
+  {
+    PTHREAD_THREADS_EVENTS = 0,
+    PTHREAD_LAST_EVENT,
+    PTHREAD_HANDLES_NUM,
+    PTHREAD_HANDLES,
+    PTHREAD_KEYS,
+    LINUXTHREADS_PTHREAD_THREADS_MAX,
+    LINUXTHREADS_PTHREAD_KEYS_MAX,
+    LINUXTHREADS_PTHREAD_SIZEOF_DESCR,
+    LINUXTHREADS_CREATE_EVENT,
+    LINUXTHREADS_DEATH_EVENT,
+    LINUXTHREADS_REAP_EVENT,
+    NUM_MESSAGES
+  };
+
+
 /* Comment out the following for less verbose output.  */
 #ifndef NDEBUG
 # define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
@@ -80,4 +98,8 @@ ta_ok (const td_thragent_t *ta)
   return runp != NULL;
 }
 
+
+/* Internal wrapper around ps_pglobal_lookup.  */
+extern int td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr);
+
 #endif /* thread_dbP.h */