This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in testsuite/gdb.base/tls.c


I'm seeing a lot of test suite hangs with the new tls.c.
I tracked it down to this code:

  for( i = 0; i < N_THREADS; i++ )
    {
      do
	{
	  errno = 0;

	  if (sem_wait (&tell_main) == -1)
	    {
	      if (errno != EINTR)
		{
		  ...
		  return;
		}
	      ...
	    }
	  }
	  while (errno == EINTR);
    }

It turns out that errno can be EINTR even when the return value is 0!
That screws up the loop counter.

This happened with Red Hat Linux 8, glibc 2.2.93-5-rh.  It is sensitive
to the placement of breakpoints, which is not surprising.

I think it's normal Unix semantics that when the return value is zero,
errno has no meaning.

I'll code up a patch for tls.c, on those lines.

Michael C


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