From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Wv0iK1l7q2QpSBwAWB0awg (envelope-from ) for ; Sun, 09 Jul 2023 23:30:33 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=fZON0CBm; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A264A1E0BD; Sun, 9 Jul 2023 23:30:33 -0400 (EDT) Received: from server2.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 938C01E0AC for ; Sun, 9 Jul 2023 23:30:31 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C41D2385771A for ; Mon, 10 Jul 2023 03:30:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C41D2385771A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688959830; bh=8bxm0YpQAyfOx4fpYAaCqfXfVS3KZb915TJx60FbqTQ=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=fZON0CBmPWLw/ktjA41lKm9hUkPZ/fbYrk3cpnmrZnlcNJwnfjr4XCb3N95Xwu5H0 gb7oXwF58aN6JstrhtHpp1O3lknRPuRsb3CwQtoJrd3alZJW7091xzAqyQrFxloD3q fjuWSatnZDgKeuCU0t6+svBSJw+uVKD7BCkuCPiw= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 3D3BE3858C2C; Mon, 10 Jul 2023 03:30:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D3BE3858C2C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 36A3U2EQ023149 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jul 2023 23:30:06 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 36A3U2EQ023149 Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 914BF1E0AC; Sun, 9 Jul 2023 23:30:01 -0400 (EDT) Message-ID: Date: Sun, 9 Jul 2023 23:30:01 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 3/7] bfd: Improve nm and objdump without section header Content-Language: en-US To: "H.J. Lu" Cc: binutils@sourceware.org, Alan Modra , Florian Weimer , Kaylee Blake , "gdb-patches@sourceware.org" References: <20230606175846.399377-1-hjl.tools@gmail.com> <20230606175846.399377-4-hjl.tools@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 10 Jul 2023 03:30:02 +0000 X-Spam-Status: No, score=-3031.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > It works for me: > > $ make check TESTS="gdb.base/eu-strip-infcall.exp" > .... > === gdb Summary === > > # of expected passes 1 > > My change only impacts files without section header. eu-strip-infcall.exp does > "eu-strip -f ${binfile}.debug $binfile", which doesn't remove section header. > I can reliably reproduce the problem on two separate machine, one Ubuntu 22.04 and one failrly up to date Arch Linux. elfutils version 0.186 and 0.189, respectively. It goes wrong when GDB does a bfd_check_format call on testsuite/outputs/gdb.base/eu-strip-infcall/eu-strip-infcall.debug. Before you commit it works, and after your commit it returns false. It happens in this new statement added to elf_object_p, added by the commit: if ((i_phdr->p_offset + i_phdr->p_filesz) > filesize) goto got_no_match; (top-gdb) p i_phdr->p_offset $1 = 8192 (top-gdb) p i_phdr->p_filesz $2 = 196 (top-gdb) p filesize $3 = 5104 (top-gdb) p i $4 = 4 It would be this program header causing the condition to fail: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ... LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x0000c4 0x0000c4 R 0x1000 So, the program header of the .debug file describes the segments of the main binary, not sure if that's expected. Simon