From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24850 invoked by alias); 29 Jul 2003 20:44:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24843 invoked from network); 29 Jul 2003 20:44:53 -0000 Received: from unknown (HELO concert.shout.net) (204.253.184.25) by sources.redhat.com with SMTP; 29 Jul 2003 20:44:53 -0000 Received: from duracef.shout.net (duracef.shout.net [204.253.184.12]) by concert.shout.net (8.12.9/8.12.9) with ESMTP id h6TKiqin016865; Tue, 29 Jul 2003 15:44:52 -0500 Received: from duracef.shout.net (localhost [127.0.0.1]) by duracef.shout.net (8.12.9/8.12.9) with ESMTP id h6TKiqHK016862; Tue, 29 Jul 2003 15:44:52 -0500 Received: (from mec@localhost) by duracef.shout.net (8.12.9/8.12.9/Submit) id h6TKiqKF016861; Tue, 29 Jul 2003 16:44:52 -0400 Date: Tue, 29 Jul 2003 20:44:00 -0000 From: Michael Elizabeth Chastain Message-Id: <200307292044.h6TKiqKF016861@duracef.shout.net> To: ezannoni@redhat.com, gdb-patches@sources.redhat.com Subject: [rfa/testsuite] gdb.threads/tls.{exp,c} fixes X-SW-Source: 2003-07/txt/msg00518.txt.bz2 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 * 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 $" {