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 974EB385B831 for ; Mon, 23 Mar 2020 17:33:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 974EB385B831 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 02NHXAbG026876 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2020 13:33:14 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 02NHXAbG026876 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (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 F31CE1E581; Mon, 23 Mar 2020 13:33:09 -0400 (EDT) Subject: Re: BFD interface for getting PE import section data To: Nick Clifton , Binutils References: <35bcce03-10f0-4e11-3d96-40a3d59cc27e@polymtl.ca> <5344fcc7-9f1f-2d3e-b76e-0ecd3268bdd9@redhat.com> From: Simon Marchi Message-ID: Date: Mon, 23 Mar 2020 13:33:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <5344fcc7-9f1f-2d3e-b76e-0ecd3268bdd9@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 23 Mar 2020 17:33:10 +0000 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_LOTSOFHASH, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2020 17:33:19 -0000 On 2020-03-23 1:18 p.m., Nick Clifton wrote: > Hi Simon, > > [Sorry for the long delay in replying to your email]. > >> However, this sounds like some facility BFD should provide. Is there a way to get >> this information that I'm missing? > > Hmm - only if you have access to the BFD library's internal headers. (Which > I assume you do not want to have to do). Hi Nick, In fact, since this is in GDB, we do have access to BFD's internal header. It's not ideal, but it works. Even before my work on this, there was an instance of accessing this internal structure: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/amd64-windows-tdep.c;h=6d5076d1c4371becf4b122a5393ede780cd0f37a;hb=HEAD#l954 I got inspiration from that code and I also implemented what I wanted by accessing that internal structure, this is what I ended up doing: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=gdb/windows-tdep.c;h=31b7b57005df67f5b02e98e92b568a0cfaea97d0;hp=e02b1ceed3873e3d4906a8df62964258a777f2a4;hb=8db52437243e251c01e352cdb325bc9ace578e7c;hpb=5982a56ab9d161923e75712fcb358824748ea4ba > Would a new BFD library function help ? One that took a BFD and returned a > pointer to its internal_extra_pe_aouthdr structure (as defined in include/coff/internal.h) > or NULL if the BFD does not have one ? Providing a function like that should > be fairly simple to implement. I think it would help a bit, in that GDB wouldn't have to import a BFD internal header just for this. Simon