This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[philippe@giacinti.com: ] A patch for Linuxthreads.





Content-Description: message body text
Hello,

I've tried to understand the debug mechanism in linuxthreads-0.8 (glibc-2.1.1
RH6.0 & glibc-2.1.2 RH6.1) and I had some trouble when trying to get the debug
signal after creation of a new thread.

I seems this signal wasn't correctly raised for two reasons:
  - the signal was blocked (according to the ChangeLog, it was un-blocked then
  blocked again by H.J. Lu)

  - the raise wasn't performed because the manager thread hasn't a good p_tid.
  Because the p_tid was 0, the pthread_kill aborted because of an invalid
  handle.

Now, using the attached patch, it's possible to get the signal when a new
thread is created.
I hope it will be useful although using this patch means probably some modifi-
cations in linuxthreads handling in gdb ...

Best regards.
-- 
Philippe Giacinti
180, rue d'Altorf - 67870 Griesheim Près Molsheim - FRANCE
mailto:philippe@giacinti.com
http://www.giacinti.com


diff -Naur glibc.old/linuxthreads/manager.c glibc/linuxthreads/manager.c
--- glibc.old/linuxthreads/manager.c	Wed May 19 19:16:30 1999
+++ glibc/linuxthreads/manager.c	Mon Feb 28 13:06:46 2000
@@ -105,6 +105,8 @@
   sigfillset(&mask);
   sigdelset(&mask, __pthread_sig_cancel); /* for thread termination */
   sigdelset(&mask, SIGTRAP);            /* for debugging purposes */
+  if (__pthread_threads_debug && __pthread_sig_debug > 0)
+    sigdelset(&mask, __pthread_sig_debug);
   sigprocmask(SIG_SETMASK, &mask, NULL);
   /* Raise our priority to match that of main thread */
   __pthread_manager_adjust_prio(__pthread_main_thread->p_priority);
diff -Naur glibc.old/linuxthreads/pthread.c glibc/linuxthreads/pthread.c
--- glibc.old/linuxthreads/pthread.c	Tue Feb 16 18:40:13 1999
+++ glibc/linuxthreads/pthread.c	Mon Feb 28 13:05:37 2000
@@ -75,7 +75,7 @@
   NULL,                       /* pthread_descr p_nextlive */
   NULL,                       /* pthread_descr p_prevlive */
   NULL,                       /* pthread_descr p_nextwaiting */
-  0,                          /* int p_tid */
+  PTHREAD_THREADS_MAX+1,      /* int p_tid */
   0,                          /* int p_pid */
   0,                          /* int p_priority */
   NULL,                       /* struct _pthread_fastlock * p_lock */

diff -Naur glibc.old/linuxthreads/manager.c glibc/linuxthreads/manager.c
--- glibc.old/linuxthreads/manager.c	Fri Jan 21 02:40:19 2000
+++ glibc/linuxthreads/manager.c	Mon Feb 28 13:30:35 2000
@@ -115,6 +115,8 @@
   sigfillset(&mask);
   sigdelset(&mask, __pthread_sig_cancel); /* for thread termination */
   sigdelset(&mask, SIGTRAP);            /* for debugging purposes */
+  if (__pthread_threads_debug && __pthread_sig_debug > 0)
+    sigdelset(&mask, __pthread_sig_debug);
   sigprocmask(SIG_SETMASK, &mask, NULL);
   /* Raise our priority to match that of main thread */
   __pthread_manager_adjust_prio(__pthread_main_thread->p_priority);
diff -Naur glibc.old/linuxthreads/pthread.c glibc/linuxthreads/pthread.c
--- glibc.old/linuxthreads/pthread.c	Fri Jan 21 02:40:19 2000
+++ glibc/linuxthreads/pthread.c	Mon Feb 28 13:30:02 2000
@@ -85,7 +85,7 @@
   NULL,                       /* pthread_descr p_prevlive */
   NULL,                       /* pthread_descr p_nextwaiting */
   NULL,			      /* pthread_descr p_nextlock */
-  0,                          /* int p_tid */
+  PTHREAD_THREADS_MAX+1,      /* int p_tid */
   0,                          /* int p_pid */
   0,                          /* int p_priority */
   &__pthread_handles[1].h_lock, /* struct _pthread_fastlock * p_lock */




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]