Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Patch: Fix Windows build from --args breakage
@ 2001-11-13  9:02 Tom Tromey
  2001-11-26 15:28 ` Tom Tromey
  2001-11-26 18:34 ` Elena Zannoni
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2001-11-13  9:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pierre Muller

[ 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?

Assuming it does fix the build, is this ok to commit?

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


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

end of thread, other threads:[~2001-11-27  3:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13  9:02 Patch: Fix Windows build from --args breakage Tom Tromey
2001-11-26 15:28 ` Tom Tromey
2001-11-26 18:34 ` Elena Zannoni
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

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