From patchwork Thu Jun 5 09:29:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 1331 Received: (qmail 29462 invoked by alias); 5 Jun 2014 09:32:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29445 invoked by uid 89); 5 Jun 2014 09:32:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jun 2014 09:31:35 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WsU1D-0004ls-0b from Yao_Qi@mentor.com ; Thu, 05 Jun 2014 02:31:31 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 5 Jun 2014 02:31:30 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Thu, 5 Jun 2014 02:30:41 -0700 Message-ID: <5390387C.7050308@codesourcery.com> Date: Thu, 5 Jun 2014 17:29:32 +0800 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Jan Kratochvil CC: , Sergio Durigan Junior Subject: Re: [patch] Fix TLS access for -static -pthread References: <20140410115204.GB16411@host2.jankratochvil.net> <539018F9.5060307@codesourcery.com> <20140605080639.GA32146@host2.jankratochvil.net> In-Reply-To: <20140605080639.GA32146@host2.jankratochvil.net> X-IsSubscribed: yes On 06/05/2014 04:06 PM, Jan Kratochvil wrote: >> This patch is to set another breakpoint at the end of main, so that >> > main thread will hit it, and we can check the value of tlsvar then. >> > It is safe and we don't have to worry about whether gdb is able to >> > unwind from pthread library to main function or not. > I have to warn that it may be a bit weaker test, it never tests both threads > TLS access during the same stop, it tests only the current thread. > > But it still tests the patch works so I am fine with it (not an approval). > The patch below is to keep testing TLS access in one stop, and work around the bug of unwinding clone. WDYT? diff --git a/gdb/testsuite/gdb.threads/staticthreads.c b/gdb/testsuite/gdb.threads/staticthreads.c index 5c8eabe..db78063 100644 --- a/gdb/testsuite/gdb.threads/staticthreads.c +++ b/gdb/testsuite/gdb.threads/staticthreads.c @@ -38,7 +38,6 @@ thread_function (void *arg) #ifdef HAVE_TLS tlsvar = 2; #endif - printf ("Thread executing\n"); /* tlsvar-is-set */ while (sem_wait (&semaphore) != 0) { if (errno != EINTR) @@ -47,6 +46,7 @@ thread_function (void *arg) return NULL; } } + printf ("Thread executing\n"); /* tlsvar-is-set */ return NULL; } diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp index 9fa625a..bdc03d4 100644 --- a/gdb/testsuite/gdb.threads/staticthreads.exp +++ b/gdb/testsuite/gdb.threads/staticthreads.exp @@ -105,7 +105,7 @@ if { "$have_tls" != "" } { gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*" gdb_test "p tlsvar" " = 2" "tlsvar in thread" gdb_test "thread 1" ".*" - # Unwind from pthread_join. + # Unwind to main. gdb_test "up 10" " in main .*" gdb_test "p tlsvar" " = 1" "tlsvar in main" }