public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Petr Tesarik <ptesarik@suse.cz>
Cc: gdb-patches@sourceware.org, Jeff Mahoney <jeffm@suse.com>
Subject: Re: [PATCH v2 2/4] Make add-symbol-file's address argument optional
Date: Tue, 26 Jun 2018 02:14:00 -0000	[thread overview]
Message-ID: <5c9840aa77974522c769c43679c7a895@polymtl.ca> (raw)
In-Reply-To: <20180611120835.27343-3-ptesarik@suse.cz>

Hi Petr,

The patch LGTM, with some nits to address before pushing.

On 2018-06-11 08:08, Petr Tesarik wrote:
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 973365574f..84600bfe5f 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -18917,18 +18917,21 @@ the program is running.  To do this, use the
> @code{kill} command
> 
>  @kindex add-symbol-file
>  @cindex dynamic linking
> -@item add-symbol-file @var{filename} @var{address}
> -@itemx add-symbol-file @var{filename} @var{address} @r{[} -readnow
> @r{|} -readnever @r{]}
> -@itemx add-symbol-file @var{filename} @var{address} -s @var{section}
> @var{address} @dots{}
> +@item add-symbol-file @var{filename} @r{[} @var{address} @r{]}
> +@itemx add-symbol-file @var{filename} @r{[} @var{address} @r{]} @r{[}
> -readnow @r{|} -readnever @r{]}
> +@itemx add-symbol-file @var{filename} @r{[} @var{address} @r{]} -s
> @var{section} @var{address} @dots{}
>  The @code{add-symbol-file} command reads additional symbol table
>  information from the file @var{filename}.  You would use this command
>  when @var{filename} has been dynamically loaded (by some other means)
>  into the program that is running.  The @var{address} should give the 
> memory
> -address at which the file has been loaded; @value{GDBN} cannot figure
> -this out for itself.  You can additionally specify an arbitrary number
> +address at which the file has been loaded.
> +You can additionally specify an arbitrary number
>  of @samp{-s @var{section} @var{address}} pairs, to give an explicit
>  section name and base address for that section.  You can specify any
>  @var{address} as an expression.
> +If @var{address} is omitted, @value{GDBN} will use the section
> +addresses found in @var{filename}.  You can use @samp{-s} to
> +override this default and load a section at a different address.

I really think that this section could use some improvements:

- There are two arguments named "address", so it's not clear what the 
text refers to.
- I don't think it's useful to have the synopsis on three different 
lines, since the options are not mutually exclusive.
- It should be made clear that the positional "address" argument 
specifies the start of the .text section.  Since it is now optional, I 
also think that this positional argument should be deprecated in favor 
of using "-s .text ..."...

But none of this is a direct consequence of your patch, so your patch 
looks ok to me.

> 
>  The symbol table of the file @var{filename} is added to the symbol 
> table
>  originally read with the @code{symbol-file} command.  You can use the
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 461f60d074..3e3ab20412 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -2161,29 +2161,26 @@ add_symbol_file_command (const char *args, int 
> from_tty)

There might be the error message:

       error (_("add-symbol-file takes a file name and an address"));

that would need to be updated, now that only the file name is mandatory.

> diff --git a/gdb/testsuite/gdb.base/relocate.exp
> b/gdb/testsuite/gdb.base/relocate.exp
> index 77f6a88159..a3af8cea61 100644
> --- a/gdb/testsuite/gdb.base/relocate.exp
> +++ b/gdb/testsuite/gdb.base/relocate.exp
> @@ -73,6 +73,21 @@ gdb_test_multiple "add-symbol-file -s .text 0x200
> $binfile 0x100" $test {
>  	gdb_test "n" "Not confirmed\." $test
>      }
>  }
> +# Check that passing a single "-s .text" is equivallent to passing

equivallent -> equivalent.

Thanks,

Simon

  parent reply	other threads:[~2018-06-26  2:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 12:08 [PATCH v2 0/4] Allow loading symbol files with an offset Petr Tesarik
2018-06-11 12:08 ` [PATCH v2 1/4] Add an optional offset option to the "symbol-file" command Petr Tesarik
2018-06-11 15:23   ` Eli Zaretskii
2018-06-26  2:02   ` Simon Marchi
2018-06-11 12:08 ` [PATCH v2 2/4] Make add-symbol-file's address argument optional Petr Tesarik
2018-06-11 15:25   ` Eli Zaretskii
2018-06-11 16:50     ` Petr Tesarik
2018-06-11 17:25       ` Eli Zaretskii
2018-06-26  2:14   ` Simon Marchi [this message]
2018-06-11 12:08 ` [PATCH v2 3/4] Make sure that sorting does not change section order Petr Tesarik
2018-06-26  2:37   ` Simon Marchi
2018-06-26  5:10     ` Petr Tesarik
2018-06-26 13:26       ` Simon Marchi
2018-06-11 12:23 ` [PATCH v2 4/4] Add an optional offset option to the "add-symbol-file" command Petr Tesarik
2018-06-26  2:52   ` Simon Marchi
2018-06-22  7:52 ` [PATCH v2 0/4] Allow loading symbol files with an offset Petr Tesarik
2018-06-26  2:58   ` Simon Marchi
2018-06-26  5:01     ` Petr Tesarik
2018-06-26 15:15       ` Simon Marchi
2018-06-26 15:23         ` Petr Tesarik
2018-06-27 12:14 ` [PATCH v3 " Petr Tesarik
2018-06-27 12:14   ` [PATCH v3 2/4] Make add-symbol-file's address argument optional Petr Tesarik
2018-06-27 12:14   ` [PATCH v3 1/4] Add an optional offset option to the "symbol-file" command Petr Tesarik
2018-06-27 12:14   ` [PATCH v3 3/4] Make sure that sorting does not change section order Petr Tesarik
2018-06-27 12:33   ` [PATCH v3 4/4] Add an optional offset option to the "add-symbol-file" command Petr Tesarik
2018-06-27 12:57   ` [PATCH v3 0/4] Allow loading symbol files with an offset Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c9840aa77974522c769c43679c7a895@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=jeffm@suse.com \
    --cc=ptesarik@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).