diff options
author | Tom Tromey <tom@tromey.com> | 2017-08-06 11:07:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-11-29 09:21:43 -0700 |
commit | 02ca603a481d55e175765ab5bff30a04b86e905a (patch) | |
tree | fb350aae24af9313a5fc0e41f34c751de56ba8ce /gdb/symfile.c | |
parent | ed6c0bfb2643861636581ac8775144efa1728c7c (diff) | |
download | gdb-02ca603a481d55e175765ab5bff30a04b86e905a.zip gdb-02ca603a481d55e175765ab5bff30a04b86e905a.tar.gz gdb-02ca603a481d55e175765ab5bff30a04b86e905a.tar.bz2 |
Fix add-symbol-file usage and errors
This patch updates add-symbol-file help and error text.
It changes add-symbol-file to throw an exception if "-s" is seen but
not all of the arguments are given. Previously this was silently
ignored.
It changes the unrecognized argument message to more clearly state
what went wrong.
Finally, it updates the usage line in the help text to follow GNU
style regarding "metasyntactic variables"; a change I believe should
be made to all gdb help messages.
gdb/ChangeLog
2017-11-29 Tom Tromey <tom@tromey.com>
* symfile.c (add_symbol_file_command): Error if some arguments to
-s are missing. Change unrecognized-argument error message.
(_initialize_symfile): Fix usage text for add-symbol-file.
gdb/testsuite/ChangeLog
2017-11-29 Tom Tromey <tom@tromey.com>
* gdb.base/relocate.exp: Update invalid argument test.
Add new tests for invalid arguments.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index feb50f8..c19cdd2 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2244,8 +2244,7 @@ add_symbol_file_command (const char *args, int from_tty) expecting_sec_addr = 1; } else - error (_("USAGE: add-symbol-file <filename> <textaddress>" - " [-readnow] [-s <secname> <addr>]*")); + error (_("Unrecognized argument \"%s\""), arg); } } @@ -2257,6 +2256,11 @@ add_symbol_file_command (const char *args, int from_tty) error (_("The address where %s has been loaded is missing"), filename.get ()); + if (expecting_sec_name) + error (_("Missing section name after \"-s\"")); + else if (expecting_sec_addr) + error (_("Missing section address after \"-s\"")); + /* Print the prompt for the query below. And save the arguments into a sect_addr_info structure to be passed around to other functions. We have to split this up into separate print @@ -3882,11 +3886,11 @@ to execute."), &cmdlist); 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>\ - ...]\nADDR is the starting address of the file's text.\n\ -The optional arguments are section-name section-address pairs and\n\ +Usage: add-symbol-file FILE ADDR [-readnow | -s SECT-NAME SECT-ADDR]...\n\ +ADDR is the starting address of the file's text.\n\ +Each '-s' argument provides a section name and address, and\n\ should be specified if the data and bss segments are not contiguous\n\ -with the text. SECT is a section name to be loaded at SECT_ADDR."), +with the text. SECT-NAME is a section name to be loaded at SECT-ADDR."), &cmdlist); set_cmd_completer (c, filename_completer); |