From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3kEoHNGgrV+ZWAAAWB0awg (envelope-from ) for ; Thu, 12 Nov 2020 15:53:37 -0500 Received: by simark.ca (Postfix, from userid 112) id 663EF1F08B; Thu, 12 Nov 2020 15:53:37 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A25EC1E552 for ; Thu, 12 Nov 2020 15:53:36 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E7655386EC4D; Thu, 12 Nov 2020 20:53:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7655386EC4D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605214415; bh=0XgJAk9o2c9J73dhGiNezGN6AXuO7m179JvZO0DqJqw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fA64HMcTYD3Xp5zgpi2IazW5iC8t5GugHKFY0Qd9iafTo7lk94Vr6/CO75P3YkTlJ MGsMW7QBCyTLLSZgN3eZY6It3vDYr5aHSEj4iTKdlAlG57Bc+Zunz2KlwADOR3s9ed uGqmvEYF7yvoBPZ1KNlG3nQYZjw7/RugJrrtF9oQ= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 2BCEC386EC4D for ; Thu, 12 Nov 2020 20:53:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2BCEC386EC4D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367--7Z6HnsrNLiWGS7er-HetA-1; Thu, 12 Nov 2020 15:53:29 -0500 X-MC-Unique: -7Z6HnsrNLiWGS7er-HetA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 034EF803625 for ; Thu, 12 Nov 2020 20:53:29 +0000 (UTC) Received: from theo.uglyboxes.com.com (ovpn-113-189.phx2.redhat.com [10.3.113.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF13E55784 for ; Thu, 12 Nov 2020 20:53:28 +0000 (UTC) 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 Message-Id: <20201112205327.2733425-1-keiths@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Keith Seitz via Gdb-patches Reply-To: Keith Seitz Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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 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