From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5637 invoked by alias); 9 Feb 2008 15:48:58 -0000 Received: (qmail 5628 invoked by uid 22791); 9 Feb 2008 15:48:58 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 09 Feb 2008 15:48:38 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 64C6698300; Sat, 9 Feb 2008 15:48:36 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 1ECCF9814D; Sat, 9 Feb 2008 15:48:36 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JNrwQ-0008Qv-FT; Sat, 09 Feb 2008 10:48:34 -0500 Date: Sat, 09 Feb 2008 15:48:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: RFC: Allow a wrapper when starting programs Message-ID: <20080209154834.GA32141@caradoc.them.org> Mail-Followup-To: Eli Zaretskii , gdb-patches@sourceware.org References: <20080208185727.GA30185@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00164.txt.bz2 On Sat, Feb 09, 2008 at 10:47:15AM +0200, Eli Zaretskii wrote: > > --- fork-child.c 29 Jan 2008 21:11:24 -0000 1.38 > > +++ fork-child.c 8 Feb 2008 18:46:39 -0000 > > Do all supported platform use fork-child to run the inferior? If not, > those that don't will not have this feature, and this fact should be > reflected in the manual. I was wondering about that. Will keeping the list up to date be a problem? Every native (non-remote) target uses fork-child, except for DJGPP, Cygwin, mingw32, and QNX NTO. > > + if (exec_wrapper) > > + pending_execs++; > > You seem to be assuming that the wrapper is a simple command that > exec's only once. But in fact the wrapper could be an arbitrarily > complex script that exec's several times, right? If a single-exec > limitation is something we cannot easily overcome, we must document it > clearly in the manual. For a typical script, this isn't an issue. Forks are not caught, nor are execs after forking. So this would work: #!/bin/sh touch /tmp/logfile exec "$@" 2> my-stderr.txt Of course, you could chain wrappers: "set exec-wrapper env env". And GDB could make the number of traps configurable for that case. But I don't think it's useful, and it's hard to explain. So I would prefer not to support it until someone finds a way to take advantage of chaining. > > +void > > +_initialize_fork_child (void) > > +{ > > + add_setshow_filename_cmd ("exec-wrapper", class_run, &exec_wrapper, _("\ > > +Set a wrapper for running programs."), _("\ > > +Show the wrapper for running programs."), NULL, > > That is rather cryptic, IMO. How about adding a few more words about > what is a wrapper and how it is used? > > > + The wrapper will run until its first > > +debug trap before @value{GDBN} takes control. > > + > > +On Unix systems, a debug trap (@code{SIGTRAP}) is generated at the > > +@code{execve} system call. This allows any program which uses > > +@code{execve} to start another program to be used as a wrapper. > > This is not detailed enough to be useful to anyone but a GDB hacker > who also happened to read the respective portions of the code in > fork-child.c. In any case, it left me wondering what is this all > about, and why I, as a GDB user, should care about SIGTRAPs. > > IOW, if this is important for the user to know, we should explain the > issue in terms understandable by a GDB user. This is where I get stuck. I did the best I could, but the effect of waiting for an extra trap is hard to describe except in terms of signals or examples. I don't know what else to add. -- Daniel Jacobowitz CodeSourcery