From patchwork Wed Mar 4 09:14:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5445 Received: (qmail 25513 invoked by alias); 4 Mar 2015 09:14:33 -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 25500 invoked by uid 89); 4 Mar 2015 09:14:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 04 Mar 2015 09:14:32 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t249EUBN028843 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 4 Mar 2015 04:14:31 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t249ETfv029090 for ; Wed, 4 Mar 2015 04:14:30 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] gdb.threads/clone-thread_db.c: Add missing includes and fix pthread_join call Date: Wed, 4 Mar 2015 09:14:28 +0000 Message-Id: <1425460468-24235-1-git-send-email-palves@redhat.com> This fixes: > gdb compile failed, /gdb/testsuite/gdb.threads/clone-thread_db.c: In function 'main': > /gdb/testsuite/gdb.threads/clone-thread_db.c:67:3: warning: implicit declaration of function 'alarm' [-Wimplicit-function-declaration] > alarm (300); > ^ > /gdb/testsuite/gdb.threads/clone-thread_db.c:69:3: warning: implicit declaration of function 'pthread_create' [-Wimplicit-function-declaration] > pthread_create (&child, NULL, thread_fn, NULL); > ^ > /gdb/testsuite/gdb.threads/clone-thread_db.c:70:3: warning: implicit declaration of function 'pthread_join' [-Wimplicit-function-declaration] > pthread_join (child); > ^ And then adding the missing headers revealed the pthread_join call was incorrect. This probably fixes the crash we see on ppc64be, e.g., at https://sourceware.org/ml/gdb-testers/2015-q1/msg04415.html the logs there show: ... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x3fffb7ff54a0 (LWP 9275)] 0x00003fffb7f3ce74 in .pthread_join () from /lib64/libpthread.so.0 (gdb) FAIL: gdb.threads/clone-thread_db.exp: continue to end ... Tested on x86_64 Fedora 20. gdb/testsuite/ 2015-03-04 Pedro Alves * gdb.threads/clone-thread_db.c: Include unistd.h and pthread.h. (main): Pass missing retval argument to pthread_join call. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.threads/clone-thread_db.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3b7bf7d..eb1b9ea 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-04 Pedro Alves + + * gdb.threads/clone-thread_db.c: Include unistd.h and pthread.h. + (main): Pass missing retval argument to pthread_join call. + 2015-03-02 Pedro Alves * gdb.threads/thread-execl.exp (do_test): Handle non-stop. diff --git a/gdb/testsuite/gdb.threads/clone-thread_db.c b/gdb/testsuite/gdb.threads/clone-thread_db.c index 4356d2f..e8dc7c3 100644 --- a/gdb/testsuite/gdb.threads/clone-thread_db.c +++ b/gdb/testsuite/gdb.threads/clone-thread_db.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #define STACK_SIZE 0x1000 @@ -67,7 +69,7 @@ main (int argc, char **argv) alarm (300); pthread_create (&child, NULL, thread_fn, NULL); - pthread_join (child); + pthread_join (child, NULL); return 0; }