Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] Add file name to "Loadable section ... outside of ELF segments" warning
Date: Thu, 12 Nov 2020 12:53:26 -0800	[thread overview]
Message-ID: <20201112205327.2733425-1-keiths@redhat.com> (raw)

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-12  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.
---
 gdb/ChangeLog | 6 ++++++
 gdb/elfread.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/elfread.c b/gdb/elfread.c
index f362bc8a62..7915dcdcce 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;
-- 
2.26.2


             reply	other threads:[~2020-11-12 20:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 20:53 Keith Seitz via Gdb-patches [this message]
2020-11-12 20:53 ` [PATCH 2/2] Exclude debuginfo files from "outside " Keith Seitz via Gdb-patches
2020-11-12 21:45   ` Tom Tromey
2020-11-12 22:18     ` Keith Seitz via Gdb-patches
2020-11-13 13:50       ` Tom Tromey
2020-11-13 17:45         ` Keith Seitz via Gdb-patches
2020-11-12 21:42 ` [PATCH 1/2] Add file name to "Loadable section ... outside " Tom Tromey

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=20201112205327.2733425-1-keiths@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    /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