Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: gdb: detection and/or fork+gethostbyname crash workaround?
@ 2001-07-24 13:00 Michael Elizabeth Chastain
  2001-07-24 13:53 ` Kevin Buettner
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2001-07-24 13:00 UTC (permalink / raw)
  To: g_gdb, gdb

> 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.

How about something like this:

  /* Global variable.  Do resolve by forking a child process.
     This is usually one, but you can turn it off to make debugging
     easier. */
  int g_resolve_fork = 1;

Then in your .gdbinit file, say:

  print g_resolve_fork = 0

Alternatively, you can wire up g_resolve_fork to a command line
argument or to an environment variable.  You can set an environment
variable in gdb with "set env FOO BAR", and then stash that in a
.gdbinit file.

It doesn't solve the core problem but it might be a useful
workaround.

Michael Elizabeth Chastain
<chastain@redhat.com>
"love without fear"


^ permalink raw reply	[flat|nested] 13+ messages in thread
* gdb: detection and/or fork+gethostbyname crash workaround?
@ 2001-07-23 18:01 Glenn F. Maynard
  2001-07-24  9:23 ` Kevin Buettner
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn F. Maynard @ 2001-07-23 18:01 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2001-07-24 14:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-24 13:00 gdb: detection and/or fork+gethostbyname crash workaround? Michael Elizabeth Chastain
2001-07-24 13:53 ` Kevin Buettner
2001-07-24 14:26   ` Glenn F. Maynard
  -- strict thread matches above, loose matches on Subject: below --
2001-07-23 18:01 Glenn F. Maynard
2001-07-24  9:23 ` Kevin Buettner
2001-07-24 11:22   ` Glenn F. Maynard
2001-07-24 13:26     ` Daniel Jacobowitz
2001-07-24 13:44       ` Kevin Buettner
2001-07-24 13:26     ` Kevin Buettner
2001-07-24 13:57       ` Glenn F. Maynard
2001-07-24 14:49         ` Kevin Buettner
2001-07-24 14:22       ` Daniel Jacobowitz
2001-07-24 13:54     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox