This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Workaround for 10970, 12702, avoid calling waitpid


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

(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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]