bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthreads + execv causes gdb to get confused


From: Srini
Subject: Re: pthreads + execv causes gdb to get confused
Date: 20 Mar 2002 23:18:10 -0800

Hi,
I am also facing the same problem.
I am using RH 7.2 on IA32 box, with kernel 2.4.7-10.
U can reproduce (is it a bug????) this as follows. Use the test case given 
below.
address@hidden randd]# cat test.c
#include <stdlib.h>

int main(int argc, char **argv) {
    char *p=getenv("MYTEST");

    printf("start of mytest\n");
    if (p==NULL) {
        printf("p is null\n");
        putenv("MYTEST=yes");
        printf("calling execvp %s\n",argv[0]);
        execvp(argv[0], argv);
    } else {
        printf("p = %s\n",p);
    }
    printf("rest of program...\n");
    printf("end of mytest\n");
    exit(0);
}
address@hidden randd]# gcc -g -o test -lpthread test.c
address@hidden randd]# gdb test
GNU gdb Red Hat Linux (5.1-1)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) r
Starting program: /home/ansriniv/randd/test
[New Thread 1024 (LWP 4162)]
start of mytest
p is null
calling execvp /home/ansriniv/randd/test
Cannot find user-level thread for LWP 4162: generic error
(gdb) c
Continuing.
Cannot find thread 1024: generic error
(gdb)



address@hidden (Patrick Doyle) wrote in message news:<address@hidden>...
> Hi.  I hope this is helpful...
> 
> When debugging a program that uses pthreads, a call to execv causes
> gdb to get mighty confused:
> 
> (gdb) run
> Starting program: abc
> [New Thread 1024 (LWP 8440)]
> Breakpoint 2 (...)
> 736             execvp(argv[0], argv);
> (gdb) cont
> Continuing.
> Cannot find user-level thread for LWP 8445: generic error
> (gdb) bt
> Cannot find thread 1024: generic error
> (gdb) quit
> The program is running.  Exit anyway? (y or n) y
> Cannot find thread 1024: generic error
> (gdb) [5]   Terminated              gdb abc
> 
> [6]+  Stopped                 gdb abc
> [bash]$ kill %
> 
> [6]+  Stopped                 gdb abc
> [bash]$
> [6]+  Terminated              gdb abc
> [bash]$
> 
> This is Red Hat 7.2 and GNU gdb 20020225.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]