aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2006-02-21 19:13:20 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2006-02-21 19:13:20 +0000
commit5b96932ba38475227c261557a886e1dff1948ce6 (patch)
tree39362d0958064e52652de8cd730a6853f0c01a1e /gdb/symfile.c
parent1986bccdb576b7758273dfa5ec8274c6be55f268 (diff)
downloadgdb-5b96932ba38475227c261557a886e1dff1948ce6.zip
gdb-5b96932ba38475227c261557a886e1dff1948ce6.tar.gz
gdb-5b96932ba38475227c261557a886e1dff1948ce6.tar.bz2
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. testsuite/ * gdb.base/help.exp (help add-symbol-file): Update.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index c7168c0..841d738 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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\