From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24442 invoked by alias); 18 May 2011 19:53:19 -0000 Received: (qmail 24426 invoked by uid 22791); 18 May 2011 19:53:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 May 2011 19:53:01 +0000 Received: (qmail 15219 invoked from network); 18 May 2011 19:52:59 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 May 2011 19:52:59 -0000 From: Pedro Alves To: Jan Kratochvil Subject: Re: [patch] Workaround for 10970, 12702, avoid calling waitpid Date: Wed, 18 May 2011 19:53:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.2; x86_64; ; ) Cc: gdb-patches@sourceware.org, Doug Evans References: <20110517181920.7EE51246196@ruffy.mtv.corp.google.com> <201105182017.22006.pedro@codesourcery.com> <20110518193226.GA14601@host1.jankratochvil.net> In-Reply-To: <20110518193226.GA14601@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201105182052.57287.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00410.txt.bz2 On Wednesday 18 May 2011 20:32:26, Jan Kratochvil wrote: > On Wed, 18 May 2011 21:17:21 +0200, Pedro Alves wrote: > > When the last lwp exits, we'll report it's exit code as the > > inferior exit code to infrun, instead of the leader's exit > > code. > > Which is correct, isn't it? > > $ ./groupexit; echo $? > 5 Ah, good. I didn't think of _exit... Thanks. > > (gdb) run > Starting program: /home/jkratoch/t/groupexit > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > [New Thread 0x7ffff7822700 (LWP 18087)] > [Thread 0x7ffff7822700 (LWP 18087) exited] > [Inferior 1 (process 18084) exited with code 05] > > > Thanks, > Jan > > > #include > #include > #include > static void *start (void *arg) > { > sleep (1); > _exit (5); > return arg; > } > int main (void) > { > pthread_t thread1; > int i; > i = pthread_create (&thread1, NULL, start, NULL); > assert (i == 0); > pthread_exit (NULL); > assert (0); > return 0; > } > -- Pedro Alves