[patch] Workaround for 10970, 12702, avoid calling waitpid
Pedro Alves
pedro@codesourcery.com
Wed May 18 19:53:00 GMT 2011
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 <pthread.h>
> #include <assert.h>
> #include <unistd.h>
> 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
More information about the Gdb-patches
mailing list