From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1155 invoked by alias); 22 Jul 2012 19:00:57 -0000 Received: (qmail 1135 invoked by uid 22791); 22 Jul 2012 19:00:56 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 Jul 2012 19:00:37 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6MJ0Iq9011057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 22 Jul 2012 15:00:37 -0400 Received: from host2.jankratochvil.net (ovpn-116-30.ams2.redhat.com [10.36.116.30]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6MJ0EAM023103 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 22 Jul 2012 15:00:16 -0400 Date: Sun, 22 Jul 2012 19:00:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 01/10] change gdb to refcount bfd everywhere Message-ID: <20120722190009.GA25479@host2.jankratochvil.net> References: <87vchk3lxs.fsf@fleche.redhat.com> <20120719141750.GB23801@host2.jankratochvil.net> <877gtzxyck.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877gtzxyck.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-07/txt/msg00433.txt.bz2 On Thu, 19 Jul 2012 22:58:03 +0200, Tom Tromey wrote: > >>>>> "Jan" == Jan Kratochvil writes: > > Jan> The comments are present in both and neither is a reference, they > Jan> are already out of sync. > > I don't really follow, There was some conclusion on gdb-patches to make happy both people wanting comments in *.c and people wanting comments in *.h and to prevent duplication of the same comment in both *.c and *.h which leads to stale invalid comments in one of the files to put the comment only in *.h file and in the *.c file state: /* See gdb_bfd.h. */ You even use it at various functions in gdb_bfd.c, just not for gdb_bfd_ref and gdb_bfd_unref. > >> @@ -2519,14 +2512,10 @@ reread_symbols (void) > >> to close the descriptor but BFD lacks a way of closing the > >> BFD without closing the descriptor. */ > >> obfd_filename = bfd_get_filename (objfile->obfd); > >> - if (!bfd_close (objfile->obfd)) > >> - error (_("Can't close BFD for %s: %s"), objfile->name, > >> - bfd_errmsg (bfd_get_error ())); > >> + gdb_bfd_unref (objfile->obfd); > >> objfile-> obfd = bfd_open_maybe_remote (obfd_filename); > >> if (objfile->obfd == NULL) > >> error (_("Can't open %s to read symbols."), objfile->name); > >> - else > >> - objfile->obfd = gdb_bfd_ref (objfile->obfd); > > Jan> Why isn't gdb_bfd_ref missing here? > > bfd_open_maybe_remote returns a new reference. Aha, OK. > I wonder if I should rename it to gdb_bfd_open_maybe_remote, for > consistency. What do you think? I'm inclined to do it. Definitely. Thanks, Jan