This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] Fix add-symbol-file usage and errors
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Tue, 7 Nov 2017 14:50:47 +0000
- Subject: Re: [RFA 1/2] Fix add-symbol-file usage and errors
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6DD7C7EAA6
- References: <20171104223455.539-1-tom@tromey.com> <20171104223455.539-2-tom@tromey.com>
Hi Tom,
This looks mostly good to me, except the two issues pointed out
below. Fix those that this is good to me.
On 11/04/2017 10:34 PM, Tom Tromey wrote:
> @@ -2261,6 +2260,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\""));
Could you add tests for these?
> +
> /* 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
> @@ -3883,8 +3887,8 @@ 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\
> +Usage: add-symbol-file FILE ADDR [-readnow | -s SECT SECT_ADDR]...\n\
> +ADDR is the starting address of the file's text.\n\
> The optional arguments are section-name section-address pairs and\n\
It feels like this "The optional arguments are section..." sentence
should be adjusted too, since "-readnow" is also optional. Agree?
> 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."),
> diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
> index 5639cc8847..00327f5026 100644
> --- a/gdb/testsuite/gdb.base/relocate.exp
> +++ b/gdb/testsuite/gdb.base/relocate.exp
> @@ -31,9 +31,10 @@ gdb_reinitialize_dir $srcdir/$subdir
>
> #Check that invalid options are rejected.
> foreach x {"-raednow" "readnow" "foo" "-readnow s"} {
> + set word [lindex $x [expr [llength $x]-1]]
> gdb_test "add-symbol-file ${binfile} 0 $x" \
> - "USAGE: add-symbol-file <filename> <textaddress>.*-readnow.*-s <secname> <addr>.*" \
> - "add-symbol-file: unknown option $x"
> + "Unrecognized argument \"$word\"" \
> + "add-symbol-file: unknown option $word"
> }
Thanks,
Pedro Alves