bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LinuxThreads: Thread manager blocks __pthread_sig_debug


From: Daniel Junglas
Subject: LinuxThreads: Thread manager blocks __pthread_sig_debug
Date: Thu, 2 Aug 2001 11:17:22 +0200 (MEST)

Hi there,

I have run into a problem using the debugging facilities of libpthread.
I have set __pthread_threads_debug to 1 and expected to receive a
__pthread_sig_debug for each new thread I create. However, I did not get
any signal with number __pthread_sig_debug (except one for the thread
manager which is raised during manager initialization in
__pthread_initialize_manager (pthread.c))!

I have figured that one of the first things the thread manager does in
__pthread_manager (manager.c) is to block all signals but
__pthread_sig_cancel and SIGTRAP:

--- SNIP ---
 /* Block all signals except __pthread_sig_cancel and SIGTRAP */
  sigfillset(&mask);
  sigdelset(&mask, __pthread_sig_cancel); /* for thread termination */
  sigdelset(&mask, SIGTRAP);            /* for debugging purposes */ 

  ...
  sigprocmask(SIG_SETMASK, &mask, NULL); 
--- SNAP ---

This especially blocks __pthread_sig_debug even if __pthread_threads_debug
is set to 1.

If debugging is enabled and a new thread is created the manager raises
__pthread_sig_debug (__pthread_manager(), manager.c):


--- SNIP ---
      switch(request.req_kind) {
...
      case REQ_DEBUG:
        /* 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));
        break;
--- SNAP ---


 This signal is supposed to stop the thread manager such that the debugger
can take this signal and any new thread into account. However, as the
signal is blocked (for the manager's lifetime) no one will ever take
notice of it!

In my eyes this is a bug. __pthread_sig_debug should not be blocked for
the thread manager if __pthread_threads_debug is true.

        Daniel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]