diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-05 13:51:34 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-11 10:26:19 +0000 |
commit | bf3386f0c13f52cf379440b4d06ed849a9f5706b (patch) | |
tree | 26cd23b8e3508cc80be1aa2e823dd778ac96f368 /gdb/doc | |
parent | 4790db149699b21113c566b8b9249953038fd3a7 (diff) | |
download | fsf-binutils-gdb-bf3386f0c13f52cf379440b4d06ed849a9f5706b.zip fsf-binutils-gdb-bf3386f0c13f52cf379440b4d06ed849a9f5706b.tar.gz fsf-binutils-gdb-bf3386f0c13f52cf379440b4d06ed849a9f5706b.tar.bz2 |
gdb: change 'maint info section' to use command options
The 'maintenance info sections' command currently takes a list of
filters on the command line. It can also accept the magic string
'ALLOBJ' which acts more like a command line flag, telling the command
to print information about all objfiles.
The manual has this to say about the options and filters:
... In addition, 'maint info sections' provides the following
command options (which may be arbitrarily combined): ...
Implying (to me at least) that I can do this:
(gdb) maint info sections ALLOBJ READONLY
to list all the read-only sections from all currently loaded object
files.
Unfortunately, this doesn't work. The READONLY filter will work, but
ALLOBJ will not be detected correctly.
It would be fairly simple to fix the ALLOBJ detection. However, I
dislike this mixing of command options (ALLOBJ) with command data (the
filters, e.g. READONLY, etc).
As this is a maintenance command, so not really intended for end
users, I think we can be a little more aggressive in "fixing" the
option parsing. So that's what I do in this commit.
The ALLOBJ mechanism is replaced with a real command
option (-all-objects). The rest of the command operates just as
before. The example above would now become:
(gdb) maint info sections -all-objects READONLY
The manual has been updated, and I added a NEWS entry to document the
change.
gdb/ChangeLog:
* NEWS: Mention changes to 'maint info sections'.
* maint.c (match_substring): Return a bool, fix whitespace issue.
(struct single_bfd_flag_info): New struct.
(bfd_flag_info): New static global.
(match_bfd_flags): Return a bool, use bfd_flag_info.
(print_bfd_flags): Use bfd_flag_info.
(maint_print_section_info): Delete trailing whitespace.
(struct maint_info_sections_opts): New struct.
(maint_info_sections_option_defs): New static global.
(maint_info_sections_completer): New function.
(maintenance_info_sections): Use option parsing mechanism.
(_initialize_maint_cmds): Register command completer.
gdb/doc/ChangeLog:
* gdb.texinfo (Files): Update documentation for 'maint info
sections'.
gdb/testsuite/ChangeLog:
* gdb.base/maint-info-sections.exp: Update expected output, and
add additional tests. Again.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 29 |
2 files changed, 21 insertions, 13 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index bc84fdc..bc5a2ea 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2021-02-11 Andrew Burgess <andrew.burgess@embecosm.com> + + * gdb.texinfo (Files): Update documentation for 'maint info + sections'. + 2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com> * python.texinfo (TUI Windows In Python): Extend description of diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 3bc9e26..0b1deba 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20619,22 +20619,25 @@ command @code{help target} lists all possible targets rather than current ones. @kindex maint info sections -@item maint info sections +@item maint info sections @r{[}-all-objects@r{]} @r{[}@var{filter-list}@r{]} Another command that can give you extra information about program sections is @code{maint info sections}. In addition to the section information displayed by @code{info files}, this command displays the flags and file -offset of each section in the executable and core dump files. In addition, -@code{maint info sections} provides the following command options (which -may be arbitrarily combined): - -@table @code -@item ALLOBJ -Display sections for all loaded object files, including shared libraries. -@item @var{sections} -Display info only for named @var{sections}. -@item @var{section-flags} -Display info only for sections for which @var{section-flags} are true. -The section flags that @value{GDBN} currently knows about are: +offset of each section in the executable and core dump files. + +When @samp{-all-objects} is passed then sections from all loaded object +files, including shared libraries, are printed. + +The optional @var{filter-list} is a space separated list of filter +keywords. Sections that match any one of the filter criteria will be +printed. There are two types of filter: + +@table @code +@item @var{section-name} +Display information about any section named @var{section-name}. +@item @var{section-flag} +Display information for any section with @var{section-flag}. The +section flags that @value{GDBN} currently knows about are: @table @code @item ALLOC Section will have space allocated in the process when loaded. |