aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-11-27 03:09:44 +0000
committerTom Tromey <tromey@redhat.com>2001-11-27 03:09:44 +0000
commitc2a727faa20681db53f8e5a4aaf3387e568a2538 (patch)
tree1aeb8eeba27c487c5f1fab84b7423fa1164c4959
parent756caa3d897f60ba7a6db86e5d8af3645100a6ac (diff)
downloadfsf-binutils-gdb-c2a727faa20681db53f8e5a4aaf3387e568a2538.zip
fsf-binutils-gdb-c2a727faa20681db53f8e5a4aaf3387e568a2538.tar.gz
fsf-binutils-gdb-c2a727faa20681db53f8e5a4aaf3387e568a2538.tar.bz2
* NEWS: Update for --args.
* infcmd.c (construct_inferior_arguments): Moved from ... * fork-child.c: ... here.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/NEWS5
-rw-r--r--gdb/fork-child.c71
-rw-r--r--gdb/infcmd.c71
4 files changed, 82 insertions, 71 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6d9bd88..99aa120 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2001-11-26 Tom Tromey <tromey@redhat.com>
+
+ * NEWS: Update for --args.
+ * infcmd.c (construct_inferior_arguments): Moved from ...
+ * fork-child.c: ... here.
+
2001-11-26 Jim Blandy <jimb@redhat.com>
* symtab.c (find_pc_sect_line): Revert change of 2001-11-13; add
diff --git a/gdb/NEWS b/gdb/NEWS
index 5d94685..7f87439 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -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
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 24cd00a..21e5089 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -568,74 +568,3 @@ startup_inferior (int ntraps)
#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;
-}
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index b0d74ee..f05da5a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -257,6 +257,77 @@ notice_args_read (struct cmd_list_element *c)
}
+/* 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