gdb: add a new 'maint info target-sections' command
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 12 Feb 2021 16:10:56 +0000 (16:10 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 24 Feb 2021 16:58:02 +0000 (16:58 +0000)
commit02a79309925c71591d825f8fc4e2b79ce0faa45b
tree45cef59400fc764b30f655e1933f46b30d2ed087
parent895b7b4e4bed9eee9d4a3d55bee876055736bfd3
gdb: add a new 'maint info target-sections' command

We already have a command 'maint info sections', this command prints
all sections from all known object files.

However, GDB maintains a second section table internally.  This
section table is used when GDB wants to read directly from an object
file rather than actually reading memory on the target.  As such only
some sections (the allocatable ones) are added to this secondary
section table.

I recently ran into a situation where some of GDB's optimisations for
reading directly from the files were not working.  In 'maint info
sections' I could see that GDB knew about the object file, and did
know about the sections that it _should_ have been reading from.  But
I couldn't ask GDB which sections it had copied into its secondary
section table.

This commit adds a new command 'maint info target-sections' that fills
this gap.  This command lists only those sections that GDB has copied
into its secondary table.

You'll notice that the testsuite includes a comment indicating that
there's a bug in GDB.  Normally this is not something I would add to
the testsuite, instead we should raise an actual bugzilla bug and then
mark an xfail, however, a later patch in this series will remove this
comment once the actual bug in GDB is fixed.

gdb/ChangeLog:

* NEWS: Mention new 'maint info target-sections' command.
* maint.c (maintenance_info_target_sections): New function.
(_initialize_maint_cmds): Register new command.

gdb/doc/ChangeLog:

* gdb.texinfo (Files): Document new 'maint info target-sections'
command.

gdb/testsuite/ChangeLog:

* gdb.base/maint-info-sections.exp: Add new tests.
(check_maint_info_target_sections_output): New proc.
gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/maint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/maint-info-sections.exp
This page took 0.042131 seconds and 4 git commands to generate.