From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Glenn F. Maynard" To: gdb@sourceware.cygnus.com Subject: gdb: detection and/or fork+gethostbyname crash workaround? Date: Mon, 23 Jul 2001 18:01:00 -0000 Message-id: <20010723210115.B1359@zewt.org> X-SW-Source: 2001-07/msg00333.html 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