There appears to be a bug in GDB that interacts with 'fork' and 'gethostbyname'.

Basically, if I start an app under GDB and that app does a 'fork' and the child 
process then attempts to call 'gethostbyname', it croaks on a SIGTRAP.

Example:

int main ()
{
pid_t   PID;

PID = fork();
if (0 == PID)
{
// This call to 'sleep' is uncommented if I want to attach an instance of GDB
// to the child process.
// sleep( 20);

// This call to 'gethostbyname' will die a horrible death
// if the app is started under GDB.
struct hostent*  Data = gethostbyname( "myhost");
_exit( 0);
}
}

The problem does not occur if the app is *not* started under GDB.  Interestingly 
enough, if I start the app from the command line and then attach an instance of GDB to 
the child process, the call to 'gethostbyname' works fine.  It is only when the app is 
started under GDB that it blows up.

I am encountering this problem using GDB 5.0 under RedHat Linux 7.0 (though I've seen 
reports of this same problem with other versions of GDB and Linux).

Eric Karlson
Senior Software Architect
Addamark Technologies

email: [EMAIL PROTECTED]

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to