From: Pedro Alves Date: Wed, 4 Mar 2015 09:13:49 +0000 (+0000) Subject: gdb.threads/clone-thread_db.c: Add missing includes and fix pthread_join call X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=511aee7c3906063902415391f288460a2c116f26;p=binutils-gdb.git gdb.threads/clone-thread_db.c: Add missing includes and fix pthread_join call 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3b7bf7dbe42..eb1b9ea3d3d 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 4356d2f0f74..e8dc7c3defc 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; }