2006-02-21 Andrew Stubbs <andrew.stubbs@st.com>
authorAndrew Stubbs <andrew.stubbs@st.com>
Tue, 21 Feb 2006 19:13:20 +0000 (19:13 +0000)
committerAndrew Stubbs <andrew.stubbs@st.com>
Tue, 21 Feb 2006 19:13:20 +0000 (19:13 +0000)
* symfile.c (add_symbol_file_command): Use buildargv(), instead of
hand decoding the command line, to allow use of quotes and spaces.
(_initialize_symfile): Reorganize the help message for add-symbol-file
such that 'help files' shows a better message.

testsuite/
* gdb.base/help.exp (help add-symbol-file): Update.

gdb/ChangeLog
gdb/symfile.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/help.exp

index 42ae90cf482582d0d5862610ebceba61dea2b709..e5111186b30d5ab508451b0243242f8f41f8856e 100644 (file)
@@ -1,3 +1,10 @@
+2006-02-21  Andrew Stubbs  <andrew.stubbs@st.com>
+
+       * symfile.c (add_symbol_file_command): Use buildargv(), instead of
+       hand decoding the command line, to allow use of quotes and spaces.
+       (_initialize_symfile): Reorganize the help message for add-symbol-file
+       such that 'help files' shows a better message.
+
 2006-02-21  Andrew Stubbs  <andrew.stubbs@st.com>
 
        * sh-tdep.c (sh_generic_show_regs): Reformat both code and output.
index c7168c04057c2430f50e5c929c81f9a751b9f9bc..841d738a830a5d13995cd9d47688c2146539742b 100644 (file)
@@ -1811,6 +1811,7 @@ add_symbol_file_command (char *args, int from_tty)
   int i;
   int expecting_sec_name = 0;
   int expecting_sec_addr = 0;
+  char **argv;
 
   struct sect_opt
   {
@@ -1832,28 +1833,15 @@ add_symbol_file_command (char *args, int from_tty)
   if (args == NULL)
     error (_("add-symbol-file takes a file name and an address"));
 
-  /* Make a copy of the string that we can safely write into. */
-  args = xstrdup (args);
-
-  while (*args != '\000')
-    {
-      /* Any leading spaces? */
-      while (isspace (*args))
-       args++;
-
-      /* Point arg to the beginning of the argument. */
-      arg = args;
-
-      /* Move args pointer over the argument. */
-      while ((*args != '\000') && !isspace (*args))
-       args++;
+  argv = buildargv (args);
+  make_cleanup_freeargv (argv);
 
-      /* If there are more arguments, terminate arg and
-         proceed past it. */
-      if (*args != '\000')
-       *args++ = '\000';
+  if (argv == NULL)
+    nomem (0);
 
-      /* Now process the argument. */
+  for (arg = argv[0], argcnt = 0; arg != NULL; arg = argv[++argcnt])
+    {
+      /* Process the argument. */
       if (argcnt == 0)
        {
          /* The first argument is the file name. */
@@ -1916,7 +1904,6 @@ add_symbol_file_command (char *args, int from_tty)
                    error (_("USAGE: add-symbol-file <filename> <textaddress> [-mapped] [-readnow] [-s <secname> <addr>]*"));
              }
          }
-      argcnt++;
     }
 
   /* This command takes at least two arguments.  The first one is a
@@ -3748,8 +3735,8 @@ to execute."), &cmdlist);
   set_cmd_completer (c, filename_completer);
 
   c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command, _("\
+Load symbols from FILE, assuming FILE has been dynamically loaded.\n\
 Usage: add-symbol-file FILE ADDR [-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> ...]\n\
-Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\
 ADDR is the starting address of the file's text.\n\
 The optional arguments are section-name section-address pairs and\n\
 should be specified if the data and bss segments are not contiguous\n\
index 46fca9f9399d2c78cdf7098ffe8b19e9622067bb..9eff44b7cc748d270acab940d862c81cf21ec76a 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-21  Andrew Stubbs  <andrew.stubbs@st.com>
+
+       * gdb.base/help.exp (help add-symbol-file): Update.
+
 2006-02-21  Andrew Stubbs  <andrew.stubbs@st.com>
 
        * gdb.base/help.exp (help load): Update expected results.
index f4c6d36de6ff62f94b68cf95b1bd4fe0e0ec29ae..437c39ea2aafe8de859e719f2f83de07f7cf8480 100644 (file)
@@ -35,7 +35,7 @@ gdb_test "set height 400" "" "test set height"
 
 # use a larger expect input buffer for long help outputs.
 # test help add-symbol-file
-gdb_test "help add-symbol-file" "Usage: add-symbol-file FILE ADDR \\\[-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> \.\.\.\\\]\[\r\n\]+Load the symbols from FILE, assuming FILE has been dynamically loaded\.\[\r\n\]+ADDR is the starting address of the file's text\.\[\r\n\]+The optional arguments are section-name section-address pairs and\[\r\n\]+should be specified if the data and bss segments are not contiguous\[\r\n\]+with the text\.  SECT is a section name to be loaded at SECT_ADDR\." "help add-symbol-file"
+gdb_test "help add-symbol-file" "Load symbols from FILE, assuming FILE has been dynamically loaded\.\[\r\n\]+Usage: add-symbol-file FILE ADDR \\\[-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> \.\.\.\\\]\[\r\n\]+ADDR is the starting address of the file's text\.\[\r\n\]+The optional arguments are section-name section-address pairs and\[\r\n\]+should be specified if the data and bss segments are not contiguous\[\r\n\]+with the text\.  SECT is a section name to be loaded at SECT_ADDR\." "help add-symbol-file"
 # test help advance
 gdb_test "help advance" "Continue the program up to the given location \\(same form as args for break command\\)\.\[\r\n]+Execution will also stop upon exit from the current stack frame\." "help advance"
 # test help aliases
This page took 0.039387 seconds and 4 git commands to generate.