From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30574 invoked by alias); 27 Nov 2001 02:34:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30547 invoked from network); 27 Nov 2001 02:34:14 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by hostedprojects.ges.redhat.com with SMTP; 27 Nov 2001 02:34:14 -0000 Received: from rtl.cygnus.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id SAA22589; Mon, 26 Nov 2001 18:34:12 -0800 (PST) Received: (from ezannoni@localhost) by rtl.cygnus.com (8.11.2/8.11.0) id fAR2eVX02274; Mon, 26 Nov 2001 21:40:31 -0500 X-Authentication-Warning: krustylu.cygnus.com: ezannoni set sender to ezannoni@cygnus.com using -f From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15362.64799.663782.839427@krustylu.cygnus.com> Date: Tue, 13 Nov 2001 09:40:00 -0000 To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com, Pierre Muller Subject: Re: Patch: Fix Windows build from --args breakage In-Reply-To: <877ksdp77z.fsf@creche.redhat.com> References: <877ksdp77z.fsf@creche.redhat.com> X-Mailer: VM 6.97 under Emacs 20.7.1 X-SW-Source: 2001-11/txt/msg00254.txt.bz2 Message-ID: <20011113094000.VoEu3l8TMY4IjTe0GZhceJqxzQJ8ivjxM2_HVy_BctE@z> Tom Tromey writes: > [ Not sure if this bounced or not; resending. Apologies if you see it > twice. ] > > This is an attempt to fix the Windows build breakage I inadvertently > introduced with my `--args' patch. This patch also updates NEWS, > which Andrew pointed out I forgot to update. > > I moved the function into infcmd.c because that is where the other > `--args' processing code lies. I don't know if that is correct; > Pierre suggested infrun.c. If that is preferable tell me and I will > generate a new patch. > > I have no way of testing whether this actually fixes the Windows > build. Pierre, could you try it out? It fixes a regular solaris cross powerpc-eabi build. > > Assuming it does fix the build, is this ok to commit? > Please.... Thanks Elena > Tom > > Index: gdb/ChangeLog > from Tom Tromey > > * NEWS: Update for --args. > * infcmd.c (construct_inferior_arguments): Moved from ... > * fork-child.c: ... here. > > Index: gdb/NEWS > =================================================================== > RCS file: /cvs/src/src/gdb/NEWS,v > retrieving revision 1.36 > diff -u -r1.36 NEWS > --- gdb/NEWS 2001/11/23 23:01:53 1.36 > +++ gdb/NEWS 2001/11/26 20:11:58 > @@ -7,6 +7,11 @@ > > x86 OpenBSD i[3456]86-*-openbsd* > > +* Changes to command line processing > + > +The new `--args' feature can be used to specify command-line arguments > +for the inferior from gdb's command line. > + > *** Changes in GDB 5.1: > > * New native configurations > Index: gdb/fork-child.c > =================================================================== > RCS file: /cvs/src/src/gdb/fork-child.c,v > retrieving revision 1.15 > diff -u -r1.15 fork-child.c > --- gdb/fork-child.c 2001/11/22 00:23:11 1.15 > +++ gdb/fork-child.c 2001/11/26 20:11:58 > @@ -568,74 +568,3 @@ > #endif /* STARTUP_INFERIOR */ > stop_soon_quietly = 0; > } > - > -/* Compute command-line string given argument vector. This does the > - same shell processing as fork_inferior. */ > -/* ARGSUSED */ > -char * > -construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv) > -{ > - char *result; > - > - if (STARTUP_WITH_SHELL) > - { > - /* This holds all the characters considered special to the > - typical Unix shells. We include `^' because the SunOS > - /bin/sh treats it as a synonym for `|'. */ > - char *special = "\"!#$&*()\\|[]{}<>?'\"`~^; \t\n"; > - int i; > - int length = 0; > - char *out, *cp; > - > - /* We over-compute the size. It shouldn't matter. */ > - for (i = 0; i < argc; ++i) > - length += 2 * strlen (argv[i]) + 1; > - > - result = (char *) xmalloc (length); > - out = result; > - > - for (i = 0; i < argc; ++i) > - { > - if (i > 0) > - *out++ = ' '; > - > - for (cp = argv[i]; *cp; ++cp) > - { > - if (strchr (special, *cp) != NULL) > - *out++ = '\\'; > - *out++ = *cp; > - } > - } > - *out = '\0'; > - } > - else > - { > - /* In this case we can't handle arguments that contain spaces, > - tabs, or newlines -- see breakup_args(). */ > - int i; > - int length = 0; > - > - for (i = 0; i < argc; ++i) > - { > - char *cp = strchr (argv[i], ' '); > - if (cp == NULL) > - cp = strchr (argv[i], '\t'); > - if (cp == NULL) > - cp = strchr (argv[i], '\n'); > - if (cp != NULL) > - error ("can't handle command-line argument containing whitespace"); > - length += strlen (argv[i]) + 1; > - } > - > - result = (char *) xmalloc (length); > - result[0] = '\0'; > - for (i = 0; i < argc; ++i) > - { > - if (i > 0) > - strcat (result, " "); > - strcat (result, argv[i]); > - } > - } > - > - return result; > -} > Index: gdb/infcmd.c > =================================================================== > RCS file: /cvs/src/src/gdb/infcmd.c,v > retrieving revision 1.34 > diff -u -r1.34 infcmd.c > --- gdb/infcmd.c 2001/11/22 00:23:12 1.34 > +++ gdb/infcmd.c 2001/11/26 20:12:00 > @@ -257,6 +257,77 @@ > } > > > +/* Compute command-line string given argument vector. This does the > + same shell processing as fork_inferior. */ > +/* ARGSUSED */ > +char * > +construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv) > +{ > + char *result; > + > + if (STARTUP_WITH_SHELL) > + { > + /* This holds all the characters considered special to the > + typical Unix shells. We include `^' because the SunOS > + /bin/sh treats it as a synonym for `|'. */ > + char *special = "\"!#$&*()\\|[]{}<>?'\"`~^; \t\n"; > + int i; > + int length = 0; > + char *out, *cp; > + > + /* We over-compute the size. It shouldn't matter. */ > + for (i = 0; i < argc; ++i) > + length += 2 * strlen (argv[i]) + 1; > + > + result = (char *) xmalloc (length); > + out = result; > + > + for (i = 0; i < argc; ++i) > + { > + if (i > 0) > + *out++ = ' '; > + > + for (cp = argv[i]; *cp; ++cp) > + { > + if (strchr (special, *cp) != NULL) > + *out++ = '\\'; > + *out++ = *cp; > + } > + } > + *out = '\0'; > + } > + else > + { > + /* In this case we can't handle arguments that contain spaces, > + tabs, or newlines -- see breakup_args(). */ > + int i; > + int length = 0; > + > + for (i = 0; i < argc; ++i) > + { > + char *cp = strchr (argv[i], ' '); > + if (cp == NULL) > + cp = strchr (argv[i], '\t'); > + if (cp == NULL) > + cp = strchr (argv[i], '\n'); > + if (cp != NULL) > + error ("can't handle command-line argument containing whitespace"); > + length += strlen (argv[i]) + 1; > + } > + > + result = (char *) xmalloc (length); > + result[0] = '\0'; > + for (i = 0; i < argc; ++i) > + { > + if (i > 0) > + strcat (result, " "); > + strcat (result, argv[i]); > + } > + } > + > + return result; > +} > + > > /* This function detects whether or not a '&' character (indicating > background execution) has been added as *the last* of the arguments ARGS