From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32812 invoked by alias); 13 Mar 2015 00:13:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32789 invoked by uid 89); 13 Mar 2015 00:13:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pd0-f169.google.com Received: from mail-pd0-f169.google.com (HELO mail-pd0-f169.google.com) (209.85.192.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 13 Mar 2015 00:13:18 +0000 Received: by pdbft15 with SMTP id ft15so24120967pdb.6; Thu, 12 Mar 2015 17:13:16 -0700 (PDT) X-Received: by 10.70.100.39 with SMTP id ev7mr78245090pdb.29.1426205596438; Thu, 12 Mar 2015 17:13:16 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by mx.google.com with ESMTPSA id zi10sm348493pab.35.2015.03.12.17.13.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Mar 2015 17:13:15 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 733E1EA0139; Fri, 13 Mar 2015 10:43:10 +1030 (ACDT) Date: Fri, 13 Mar 2015 00:13:00 -0000 From: Alan Modra To: Michael Eager Cc: "gdb-patches@sourceware.org" , binutils Subject: Re: [PATCH] Support gzip compressed exec and core files in gdb Message-ID: <20150313001310.GB16488@bubble.grove.modra.org> Mail-Followup-To: Michael Eager , "gdb-patches@sourceware.org" , binutils References: <54FF77D6.7010400@eagerm.com> <20150311081454.GK11451@bubble.grove.modra.org> <5500579E.50706@eagerm.com> <20150312000822.GA8533@bubble.grove.modra.org> <5500E1A8.6030101@eagerm.com> <20150312025049.GB8533@bubble.grove.modra.org> <5501BB54.6020706@eagerm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5501BB54.6020706@eagerm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-03/txt/msg00385.txt.bz2 On Thu, Mar 12, 2015 at 09:14:12AM -0700, Michael Eager wrote: > On 03/11/15 19:50, Alan Modra wrote: > >On Wed, Mar 11, 2015 at 05:45:28PM -0700, Michael Eager wrote: > >>On 03/11/15 17:08, Alan Modra wrote: > >>>On Wed, Mar 11, 2015 at 07:56:30AM -0700, Michael Eager wrote: > >>>>On 03/11/15 01:14, Alan Modra wrote: > >>>>>On Tue, Mar 10, 2015 at 04:01:42PM -0700, Michael Eager wrote: > >>>>>>This operation cannot be done completely by BFD because BFD allows an opened > >>>>>>file to be passed to it for processing. GDB uses this functionality. > >>>>> > >>>>>I'd prefer you do this entirely outside of BFD, without adding another > >>>>>field to struct bfd. I think that can be done by simply clearing > >>>>>abfd->cacheable on files you uncompress. This prevents BFD from > >>>>>closing the file, so you won't need to open it again. > >>>> > >>>>GDB closes the exec file, then uses BFD to seek (I think when reading > >>>>syms). BFD then re-opens the file, so it needs the name of the > >>>>uncompressed file. > >>> > >>>Really? I think it quite unclean if gdb expects BFD to reopen a file > >>>that gdb has closed! > >> > >>Agreed. > >> > >>GDB doesn't expect BFD to reopen the file, per se. But it does a seek > >>on an exec file (IIRC, while reading symbols) which it previously closed > >>and when BFD notices that the file is closed, it opens it. I don't think > >>that it is feasible to remove calls to exec_close() so this doesn't happen. > > > >It looks to me that exec_close() calls bfd_close(). You won't be able > >to do anything with the bfd after bfd_close(), so I think your > >analysis is faulty and very much doubt your statement that "GDB closes > >the exec file, then uses BFD..". > > The file opened in exec_file_attach() is closed in bfd_cache_close_all(), > before the function returns, not in the call to exec_close(). The bfd > is not deleted. Thanks for tracking it down. Not a gdb problem then, but likely a BFD bug that bfd_cache_close{,_all} closes !cacheable bfds. -- Alan Modra Australia Development Lab, IBM