From: Michael Elizabeth Chastain <mec@shout.net>
To: ezannoni@redhat.com, gdb-patches@sources.redhat.com
Subject: [rfa/testsuite] gdb.threads/tls.{exp,c} fixes
Date: Tue, 29 Jul 2003 20:44:00 -0000 [thread overview]
Message-ID: <200307292044.h6TKiqKF016861@duracef.shout.net> (raw)
This patch fixes all the ERRORs that I see with
native i686-pc-linux-gnu, red hat 8.0, glibc 2.2.93-5-rh.
All the results are now PASS, FAIL, KFAIL, and UNSUPPORTED.
The tls.exp change is a one-liner to initialize a variable
in all cases (not just the PASS case).
The tls.c change is the calls to sem_wait. The current code
calls sem_wait and then tests errno. My code calls sem_wait
and tests errno only if sem_wait failed. This is important,
because I have observed a lot of test suite hangs caused by
return_value = 0, errno = EINTR (happens about 75% to 90% of
the time in my test bed).
Tested on native i686-pc-linux-gnu, red hat 8.0, glibc 2.2.93-5-rh,
with a variety of gcc's and binutils.
OK to apply?
Michael C
2003-07-29 Michael C <mec@shout.net>
* gdb.threads/tls.c (spin): Check errno only if sem_wait
actually failed.
(do_pass): Likewise.
* gdb.threads/tls.exp: Always initialize no_of_threads.
Index: gdb.threads/tls.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 tls.c
*** gdb.threads/tls.c 22 Jul 2003 15:49:45 -0000 1.1
--- gdb.threads/tls.c 29 Jul 2003 20:28:16 -0000
*************** void *spin( vp )
*** 89,114 ****
fprintf (stderr, "th %d post on tell main\n", me);
#endif
! do
{
- errno = 0;
#ifdef START_DEBUG
fprintf (stderr, "th %d start wait on tell_thread\n", me);
#endif
! if (sem_wait (&tell_thread) == -1)
! {
! if (errno != EINTR)
! {
! fprintf (stderr, "th %d wait on sem tell_thread failed\n", me);
! print_error ();
! return;
! }
#ifdef START_DEBUG
! fprintf (stderr, "th %d wait tell_thread got EINTR, rewaiting\n", me);
#endif
}
}
- while (errno == EINTR);
#ifdef START_DEBUG
fprintf (stderr, "th %d Wait on tell_thread\n", me);
--- 89,116 ----
fprintf (stderr, "th %d post on tell main\n", me);
#endif
! while (1)
{
#ifdef START_DEBUG
fprintf (stderr, "th %d start wait on tell_thread\n", me);
#endif
! if (sem_wait (&tell_thread) == 0)
! break;
!
! if (errno == EINTR)
! {
#ifdef START_DEBUG
! fprintf (stderr, "th %d wait tell_thread got EINTR, rewaiting\n", me);
#endif
+ continue;
+ }
+ else
+ {
+ fprintf (stderr, "th %d wait on sem tell_thread failed\n", me);
+ print_error ();
+ return;
}
}
#ifdef START_DEBUG
fprintf (stderr, "th %d Wait on tell_thread\n", me);
*************** do_pass()
*** 151,183 ****
}
for( i = 0; i < N_THREADS; i++ )
! {
! do
! {
! errno = 0;
!
! #ifdef START_DEBUG
! fprintf (stderr, "main %d start wait on tell_main\n", i);
! #endif
! if (sem_wait (&tell_main) == -1)
! {
! if (errno != EINTR)
! {
! fprintf (stderr, "main %d wait on sem tell_main failed\n", i);
! print_error ();
! return;
! }
#ifdef START_DEBUG
! fprintf (stderr, "main %d wait tell_main got EINTR, rewaiting\n", i);
#endif
! }
! }
! while (errno == EINTR);
! #ifdef START_DEBUG
! fprintf (stderr, "main %d wait on tell_main\n",i);
! #endif
! }
#ifdef START_DEBUG
fprintf (stderr, "main done waiting on tell_main\n");
--- 153,182 ----
}
for( i = 0; i < N_THREADS; i++ )
! {
! while (1)
! {
#ifdef START_DEBUG
! fprintf (stderr, "main %d start wait on tell_main\n", i);
#endif
! if (sem_wait (&tell_main) == 0)
! break;
! if (errno == EINTR)
! {
! #ifdef START_DEBUG
! fprintf (stderr, "main %d wait tell_main got EINTR, rewaiting\n", i);
! #endif
! continue;
! }
! else
! {
! fprintf (stderr, "main %d wait on sem tell_main failed\n", i);
! print_error ();
! return;
! }
! }
! }
#ifdef START_DEBUG
fprintf (stderr, "main done waiting on tell_main\n");
Index: gdb.threads/tls.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 tls.exp
*** gdb.threads/tls.exp 28 Jul 2003 00:57:29 -0000 1.3
--- gdb.threads/tls.exp 29 Jul 2003 20:28:17 -0000
*************** check_thread_local "third"
*** 212,217 ****
--- 212,218 ----
gdb_test "continue" ".*Breakpoint 3.*still alive.*" "continue to synch point"
+ set no_of_threads 0
send_gdb "info thread\n"
gdb_expect {
-re "^info thread\[ \t\r\n\]+(\[0-9\]+) Thread.*$gdb_prompt $" {
next reply other threads:[~2003-07-29 20:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-29 20:44 Michael Elizabeth Chastain [this message]
2003-07-29 21:13 ` Elena Zannoni
2003-07-29 21:19 ` tls test maintainer, was " Michael Snyder
2003-07-29 21:53 Michael Elizabeth Chastain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200307292044.h6TKiqKF016861@duracef.shout.net \
--to=mec@shout.net \
--cc=ezannoni@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox