From: Elena Zannoni <ezannoni@cygnus.com>
To: tromey@redhat.com
Cc: gdb-patches@sources.redhat.com,
Pierre Muller <muller@cerbere.u-strasbg.fr>
Subject: Re: Patch: Fix Windows build from --args breakage
Date: Mon, 26 Nov 2001 18:34:00 -0000 [thread overview]
Message-ID: <15362.64799.663782.839427@krustylu.cygnus.com> (raw)
In-Reply-To: <877ksdp77z.fsf@creche.redhat.com>
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 <tromey@redhat.com>
>
> * 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 @@
> }
>
> \f
> +/* 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;
> +}
> +\f
>
> /* This function detects whether or not a '&' character (indicating
> background execution) has been added as *the last* of the arguments ARGS
WARNING: multiple messages have this Message-ID
From: Elena Zannoni <ezannoni@cygnus.com>
To: tromey@redhat.com
Cc: gdb-patches@sources.redhat.com,
Pierre Muller <muller@cerbere.u-strasbg.fr>
Subject: Re: Patch: Fix Windows build from --args breakage
Date: Tue, 13 Nov 2001 09:40:00 -0000 [thread overview]
Message-ID: <15362.64799.663782.839427@krustylu.cygnus.com> (raw)
Message-ID: <20011113094000.VoEu3l8TMY4IjTe0GZhceJqxzQJ8ivjxM2_HVy_BctE@z> (raw)
In-Reply-To: <877ksdp77z.fsf@creche.redhat.com>
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 <tromey@redhat.com>
>
> * 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 @@
> }
>
> \f
> +/* 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;
> +}
> +\f
>
> /* This function detects whether or not a '&' character (indicating
> background execution) has been added as *the last* of the arguments ARGS
next prev parent reply other threads:[~2001-11-26 18:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-13 9:02 Tom Tromey
2001-11-26 15:28 ` Tom Tromey
2001-11-26 18:34 ` Elena Zannoni [this message]
2001-11-13 9:40 ` Elena Zannoni
2001-11-13 9:51 ` Tom Tromey
2001-11-13 10:51 ` Christopher Faylor
2001-11-26 19:10 ` Christopher Faylor
2001-11-26 19:05 ` Tom Tromey
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=15362.64799.663782.839427@krustylu.cygnus.com \
--to=ezannoni@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
--cc=muller@cerbere.u-strasbg.fr \
--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