about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog11
-rw-r--r--linuxthreads/manager.c8
-rw-r--r--linuxthreads/pthread.c7
3 files changed, 20 insertions, 6 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index e65ee76222..352b34356f 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,14 @@
+1999-02-03  H.J. Lu  <hjl@gnu.org>
+
+	* manager.c (__pthread_manager): Do block __pthread_sig_debug.
+	Don't restart the thread which sent REQ_DEBUG.
+	(pthread_start_thread): Check if __pthread_sig_debug > 0
+	before debugging.
+
+	* pthread.c (__pthread_initialize_manager): Suspend ourself
+	after sending __pthread_sig_debug to gdb instead of
+	__pthread_sig_cancel.
+
 1999-01-24  H.J. Lu  <hjl@gnu.org>
 
 	* manager.c (__pthread_manager): Delete __pthread_sig_debug
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 033e5adc5f..9657cc5731 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -104,8 +104,6 @@ int __pthread_manager(void *arg)
   /* Block all signals except __pthread_sig_cancel and SIGTRAP */
   sigfillset(&mask);
   sigdelset(&mask, __pthread_sig_cancel); /* for thread termination */
-  if (__pthread_sig_debug > 0)
-    sigdelset(&mask, __pthread_sig_debug); /* for debugging purposes */
   sigdelset(&mask, SIGTRAP);            /* for debugging purposes */
   sigprocmask(SIG_SETMASK, &mask, NULL);
   /* Raise our priority to match that of main thread */
@@ -162,10 +160,10 @@ int __pthread_manager(void *arg)
         sem_post(request.req_args.post);
         break;
       case REQ_DEBUG:
-        /* Make gdb aware of new thread */
+	/* Make gdb aware of new thread and gdb will restart the
+	   new thread when it is ready to handle the new thread. */
 	if (__pthread_threads_debug && __pthread_sig_debug > 0)
 	  raise(__pthread_sig_debug);
-        restart(request.req_thread);
         break;
       }
     }
@@ -195,7 +193,7 @@ static int pthread_start_thread(void *arg)
 			 THREAD_GETMEM(self, p_start_args.schedpolicy),
                          &self->p_start_args.schedparam);
   /* Make gdb aware of new thread */
-  if (__pthread_threads_debug) {
+  if (__pthread_threads_debug && __pthread_sig_debug > 0) {
     request.req_thread = self;
     request.req_kind = REQ_DEBUG;
     __libc_write(__pthread_manager_request,
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 4d182a8695..42ed581bdb 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -309,7 +309,12 @@ int __pthread_initialize_manager(void)
   __pthread_manager_thread.p_pid = pid;
   /* Make gdb aware of new thread manager */
   if (__pthread_threads_debug && __pthread_sig_debug > 0)
-    raise(__pthread_sig_cancel);
+    {
+      raise(__pthread_sig_debug);
+      /* We suspend ourself and gdb will wake us up when it is
+	 ready to handle us. */
+      suspend(thread_self());
+    }
   /* Synchronize debugging of the thread manager */
   request.req_kind = REQ_DEBUG;
   __libc_write(__pthread_manager_request, (char *) &request, sizeof(request));