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]

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


Is there any way to tell if a (C) program is being debugged by gdb?

I've had the "dynamic linking in a forked process being debugged"
bite me twice now.  The first time around, I moved the process
to another binary (a resolver binary; exec()ing it fixed this).  I'm
trying to work around this bug in another program, now, where making
a separate binary for resolving is undesirable; I want to force it
to not fork resolves when being debugged, and do so automatically.

Portability isn't much of a concern: the workaround can be autoconf'd
to only happen on the architectures it works (and/or is necessary) for.

Alternatively, a workaround for this particular bug would be equally
sufficient.  Of course, having it fixed would be nice ... it's been around
for at least a year and prevents all "fork for DNS" code from working under
gdb unless it happens to exec to do so, and it's an odd enough bug
that it's probably cost a great deal of time for those hit by it. (It's
been reported multiple times in both the "forked gethostbyname crashes"
and "forked dynamic linking crashes" guises.)

-- 
Glenn Maynard


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