From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5B11F385B835 for ; Thu, 16 Apr 2020 19:47:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5B11F385B835 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 03GJlmXH031647 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Apr 2020 15:47:53 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 03GJlmXH031647 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4F1881E5F8; Thu, 16 Apr 2020 15:47:48 -0400 (EDT) Subject: Re: [PATCH v2 1/2] gdb: make is_linked_with_cygwin_dll handle import table not at beginning of .idata section To: Pedro Alves , gdb-patches@sourceware.org References: <20200416154508.168585-1-simon.marchi@polymtl.ca> <20200416184739.205859-1-simon.marchi@polymtl.ca> From: Simon Marchi Message-ID: <42607e57-4c55-3a23-6712-b61e5fc75992@polymtl.ca> Date: Thu, 16 Apr 2020 15:47:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 16 Apr 2020 19:47:48 +0000 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Thu, 16 Apr 2020 19:47:58 -0000 On 2020-04-16 3:21 p.m., Pedro Alves wrote: > On 4/16/20 7:47 PM, Simon Marchi via Gdb-patches wrote: >> When loading the file C:\Windows\SysWOW64\msvcrt.dll, taken from a >> Windows 10 system, into GDB, we get the following warning: >> >> warning: Failed to parse .idata section: name's virtual address (0x0) is outside .idata section's range [0xb82b8, 0xb97f0[. >> >> This uncovers an issue with how we parse the import table, part of the >> .idata section. Right now, we assume that the import table is located >> at the beginning of the section. That was the case in everything I had >> tried so far, but this file is an example where that's not true. >> >> We need to compute the offset of the import table within the .idata >> section, and start there, instead of at the beginning of the .idata >> section. Using the file mentioned above, this is the values we have to >> work with: >> >> A) bfd_section_vma (idata_section) 101b8000 >> B) Import table's virtual address b82b8 >> C) Image base 10100000 >> >> The virtual address that BFD returns us for the section has the image >> base applied, so we need to subtract it first. The offset of the table >> in the section is therefore: >> >> B - (A - C) >> >> This patch implements that. >> >> gdb/ChangeLog: >> >> windows-tdep.c (is_linked_with_cygwin_dll): Consider case where >> import table is not at beginning of .idata section. > > Note the missing leading '*'. Oops, fixed. > This version looks good to me. Both patches. Both patches pushed, thanks. Simon