From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26289 invoked by alias); 7 Jan 2014 17:41:04 -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 26272 invoked by uid 89); 7 Jan 2014 17:41:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2014 17:41:03 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s07HeuXm007729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Jan 2014 12:40:57 -0500 Received: from barimba (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s07HesqP029930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 7 Jan 2014 12:40:55 -0500 From: Tom Tromey To: Pedro Alves Cc: Doug Evans , Hui Zhu , Sergio Durigan Junior , gdb-patches ml , Edjunior Barbosa Machado , Nick Clifton , Binutils Development Subject: Re: [PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983 References: <52C8358B.7080101@mentor.com> <52C97EC0.3080807@mentor.com> <87k3edseia.fsf@fleche.redhat.com> <52CA8A7F.7090907@mentor.com> <878uuslt1j.fsf@fleche.redhat.com> <52CBF47C.9010002@redhat.com> Date: Tue, 07 Jan 2014 17:41:00 -0000 In-Reply-To: <52CBF47C.9010002@redhat.com> (Pedro Alves's message of "Tue, 07 Jan 2014 12:35:08 +0000") Message-ID: <87k3ebheqh.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-01/txt/msg00148.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: Pedro> gdb has been confused and went in circles, with bfd's filename Pedro> ownership. In some places, it ended up xmalloc/xstrdup'ing the Pedro> filename instead of allocating it in the bfd's memory. Pedro> That resulted in the invention of gdb_bfd_stash_filename Pedro> https://sourceware.org/ml/gdb-patches/2012-07/msg00291.html Pedro> as a workaround. Yeah, in retrospect I should have tried to fix up BFD at that time. Pedro> I think it'd be better to allocate the filename Pedro> in the bfd's memory, like it used to be. I agree. I think your patch is better due to keeping the same error-handling approach as the rest of BFD. Pedro> WDYT? If you don't mind I think it would be good -- and easy -- to also implement Doug's suggestion, say a "bfd_set_filename" macro. Pedro> +/* A wrapper for bfd_strdup that never returns NULL. */ Pedro> + Pedro> +char *gdb_bfd_strdup (bfd *abfd, const char *str); This can be marked ATTRIBUTE_RETURNS_NONNULL. Tom