From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: close-on-exec internal file descriptors
Date: Wed, 01 May 2013 14:47:00 -0000 [thread overview]
Message-ID: <20130501144722.GA10034@adacore.com> (raw)
In-Reply-To: <87d2tmsey0.fsf@fleche.redhat.com>
Hi Tom,
> Tom> 2013-01-03 Tom Tromey <tromey@redhat.com>
>
> Tom> PR gdb/7912:
> Tom> * Makefile.in (SFILES): Add filestuff.c
> Tom> (COMMON_OBS): Add filestuff.o.
> Tom> (filestuff.o): New target.
> [...]
Unfortunately, this is causing problems on Darwin and HP/UX,
because both platforms use pipes to synchronize parent and
child during the fork/exec. See for instance darwin-nat.c:
/* The child must synchronize with gdb: gdb must set the exception port
before the child call PTRACE_SIGEXC. We use a pipe to achieve this.
FIXME: is there a lighter way ? */
static int ptrace_fds[2];
Same mechanism, and therefore problem, with HP/UX targets:
/* File descriptors for pipes used as semaphores during initial
startup of an inferior. */
static int inf_ttrace_pfd1[2];
static int inf_ttrace_pfd2[2];
In terms of behavior, GDB either hangs during process creation, or
reports a fatal failure during one of the system calls.
I don't think there is a way of opening a FD with the intention
of protecting them from the close-at-exec, is there? So, the solution
would seem to add an interface to setup the protection, as well
as a function to remove that protection (necessary when we close
the fd).
What do you think?
--
Joel
next prev parent reply other threads:[~2013-05-01 14:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 17:45 Tom Tromey
2012-12-18 22:12 ` Andreas Schwab
2012-12-19 14:53 ` Tom Tromey
2013-01-03 16:17 ` Tom Tromey
2013-04-22 23:55 ` Tom Tromey
2013-04-23 1:51 ` Tom Tromey
2013-05-01 14:47 ` Joel Brobecker [this message]
2013-05-06 18:53 ` Tom Tromey
2013-05-07 6:46 ` Joel Brobecker
2013-05-10 17:00 ` Tom Tromey
2013-04-23 15:45 ` Yao Qi
2013-04-24 2:45 ` Tom Tromey
2013-04-24 20:35 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130501144722.GA10034@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox