This is the mail archive of the gdb-prs@sources.redhat.com 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: threads/458: When GNU/Linux pthreads program calls execv, gdbrefuses to exit, must be killed


The following reply was made to PR threads/458; it has been noted by GNATS.

From: Johan Walles <johan dot walles at appeal dot se>
To: gdb-gnats at sources dot redhat dot com
Cc:  
Subject: Re: threads/458: When GNU/Linux pthreads program calls execv, gdb
 refuses to exit, must be killed
Date: Mon, 17 Mar 2003 10:28:58 +0100

 Since Patricks test case seems to have been lost, here's a repro case 
 that provokes the problem for me with gdb-5.3 on Linux / ia64:
 
 #include <stdio.h>
 #include <unistd.h>
 #include <pthread.h>
 
 void *startRoutine(void *arg)
 {
     char **argv;
 
     printf("Exec()ing...\n");
 
     argv = (char **)arg;
 
     execv(argv[0], argv+2);
 
     return NULL;
 }
 
 int main(int argc, char *argv[])
 {
     pthread_t newThread;
     if(argc > 1) {
        printf("Argc: %d\n", argc);
        pthread_create (&newThread, NULL, startRoutine, argv);
        printf("exec()ing thread started\n");
     }
     return 0;
 }
 
 Compile with "gcc -g foo.c -lpthread", and run it with one command line 
 argument in gdb-5.3:
 
 johan at mislenite:~/tabort$ /opt/gdb-5.3/bin/gdb-5.3 -nx ./a.out
 GNU gdb 5.3
 [...]
 (gdb) run argument
 Starting program: /home/johan/tabort/a.out argument
 [New Thread 1024 (LWP 29744)]
 Argc: 2
 [New Thread 2049 (LWP 29799)]
 [New Thread 1026 (LWP 29800)]
 Exec()ing...
 Cannot find user-level thread for LWP 29800: generic error
 (gdb) quit
 The program is running.  Exit anyway? (y or n) y
 Cannot find thread 2049: generic error
 (gdb)
 
 ... then I have to use kill to exit gdb :-(.
 
    Thanks //Johan
 
 


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