diff options
author | Keith Seitz <keiths@redhat.com> | 2020-11-13 09:28:50 -0800 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2020-11-13 09:28:50 -0800 |
commit | 9d3ab915be4548c6fee80c0b2f79a509fd4150b8 (patch) | |
tree | e360d1a36a6bc5f644d9a4fcf069fa44628abcdf | |
parent | 9ecab40c77fd414fe408967d0f92f00494aa11b9 (diff) | |
download | gdb-9d3ab915be4548c6fee80c0b2f79a509fd4150b8.zip gdb-9d3ab915be4548c6fee80c0b2f79a509fd4150b8.tar.gz gdb-9d3ab915be4548c6fee80c0b2f79a509fd4150b8.tar.bz2 |
Add file name to "Loadable section ... outside of ELF segments" warning
As requested in gdb/23034, I would like to extend the warning message
GDB displays when it detects a loadable section that is outside any
ELF segment.
Before:
$ gdb -q --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec
Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752.
warning: Loadable section ".note.gnu.property" outside of ELF segments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
[snip]
Breakpoint 1, systemctl_main (argv=0x7fffffffd348, argc=2) at ../src/systemctl/systemctl.c:8752
8752 r = systemctl_main(argc, argv);
After:
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libcap.so.2
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libacl.so.1
[snip]
I think this is eminently more useful output.
gdb/ChangeLog
2020-11-13 Keith Seitz <keiths@redhat.com>
PR gdb/23034
* elfread.c (elf_symfile_segments): Output a BFD file name
for the "Loadable section ... outside of ELF segments" warning.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/elfread.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4eb64c1..f8f6993 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-11-13 Keith Seitz <keiths@redhat.com> + + PR gdb/23034 + * elfread.c (elf_symfile_segments): Output a BFD file name + for the "Loadable section ... outside of ELF segments" warning. + 2020-11-13 Simon Marchi <simon.marchi@polymtl.ca> PR gdb/26835 diff --git a/gdb/elfread.c b/gdb/elfread.c index f362bc8..7915dcd 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -149,8 +149,8 @@ elf_symfile_segments (bfd *abfd) binaries are not relocatable. */ if (bfd_section_size (sect) > 0 && j == num_segments && (bfd_section_flags (sect) & SEC_LOAD) != 0) - warning (_("Loadable section \"%s\" outside of ELF segments"), - bfd_section_name (sect)); + warning (_("Loadable section \"%s\" outside of ELF segments\n in %s"), + bfd_section_name (sect), bfd_get_filename (abfd)); } return data; |