This is the mail archive of the gdb@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]

Re: gdb: detection and/or fork+gethostbyname crash workaround?


"Glenn F. Maynard" <g_gdb@zewt.org> writes:

> > I searched gdb@sources.redhat.com w/ both of these search phrases and
> > only came up with the message to which I'm responding.  Can you provide
> > some URLs for the archived messages?
> 
> http://sources.redhat.com/ml/bug-glibc/2000-04/msg00018.html
> http://sources.redhat.com/ml/bug-gdb/2001-03/msg00049.html
> 
> (the first is more useful; it was apparently CC'd to both
> bug-glibc and bug-gdb, but that's what google turned up.)

Hmm, I'd expect a Trace/breakpoint trap...

Yup, that's what I get.  What's happening is that when you fork, GDB
has its breakpoints inserted in the inferior.  Therefore the child
inherits those breakpoints from its parents.  When it trips such a
breakpoint, it gets killed since the child isn't traced by GDB.

In this particular case it's a GDB-internal solib_event breakpoint
that gets tripped, since gethostbyname() causes one or more NSS
modules to be loaded.

It's not easy to solve this (and I suspect that a lot of platforms
suffer from the same problems).  Implementing the follow-fork stuff
for Linux would probably do the trick.  Perhaps I can find some time
to implement that, but it won't be ready for the next release.

Mark


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