From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22873 invoked by alias); 29 Jul 2003 21:13:47 -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 22839 invoked from network); 29 Jul 2003 21:13:46 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 29 Jul 2003 21:13:46 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h6TLDkZ06079 for ; Tue, 29 Jul 2003 17:13:46 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h6TLDkI21071 for ; Tue, 29 Jul 2003 17:13:46 -0400 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h6TLDiL31520; Tue, 29 Jul 2003 17:13:45 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id B56622CB2C; Tue, 29 Jul 2003 17:21:14 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16166.58698.342251.249709@localhost.redhat.com> Date: Tue, 29 Jul 2003 21:13:00 -0000 To: Michael Elizabeth Chastain Cc: ezannoni@redhat.com, gdb-patches@sources.redhat.com Subject: Re: [rfa/testsuite] gdb.threads/tls.{exp,c} fixes In-Reply-To: <200307292044.h6TKiqKF016861@duracef.shout.net> References: <200307292044.h6TKiqKF016861@duracef.shout.net> X-SW-Source: 2003-07/txt/msg00523.txt.bz2 Michael Elizabeth Chastain writes: > 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. > thanks, seems to work for me too. elena > 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 $" {