From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31208 invoked by alias); 11 Jan 2013 17:48:04 -0000 Received: (qmail 31179 invoked by uid 22791); 11 Jan 2013 17:48:02 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Fri, 11 Jan 2013 17:47:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0BHlteF016914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Jan 2013 12:47:55 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0BHlrSu015042; Fri, 11 Jan 2013 12:47:53 -0500 Message-ID: <50F05048.3070702@redhat.com> Date: Fri, 11 Jan 2013 17:48:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jan Kratochvil CC: Sergio Durigan Junior , GDB Patches , Binutils Development , "H.J. Lu" Subject: Re: [PATCH/RFC 02/02 v2] Refactor PRPSINFO handling on GDB References: <20121218171555.GA19639@host2.jankratochvil.net> <20121231194134.GA17955@host2.jankratochvil.net> <50EF0BE3.6040503@redhat.com> <50F02661.8020400@redhat.com> <20130111171145.GA26852@host2.jankratochvil.net> In-Reply-To: <20130111171145.GA26852@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2013-01/txt/msg00237.txt.bz2 On 01/11/2013 05:11 PM, Jan Kratochvil wrote: > On Fri, 11 Jan 2013 18:03:01 +0100, Sergio Durigan Junior wrote: >> On Friday, January 11 2013, Pedro Alves wrote: >>> On 01/11/2013 03:53 AM, Sergio Durigan Junior wrote: >>>>>> + /* Generating and copying the program's arguments. `get_inferior_args' >>>>>> + may throw, but we want to continue the execution anyway. */ >>>>>> + TRY_CATCH (ex, RETURN_MASK_ERROR) >>>>>> + { >>>>>> + infargs = get_inferior_args (); >>>>>> + } >>>>>> + >>>>> >>>>> Hmm? We were not doing that before. What exception is that? >>>> >>>> `get_inferior_args' calls `construct_inferior_arguments', which can call >>>> `error' in an specific scenario (not STARTUP_WITH_SHELL, arguments that >>>> contain spaces). >>> >>> This is an example of something that should be split into >>> its own change, along with its own rationale. This is >>> independent of any refactoring of PRPSINFO handling. >>> We're already calling get_inferior_args nowadays, and I don't >>> ever remember this error being reported as a problem. >> >> My first version of the patch didn't contain the TRY_CATCH part. It was >> Jan who made this suggestion, and I thought it made sense. Sorry, I missed that. >> I really think a TRY_CATCH does not cause any harm here, but if you >> insist, I can easily remove it from the patch. > > I do not think there should be code leaking memory in a case of throwsn > exception when the callee contains an error() call. Agreed, of course. > Even if the error() call is only in a conditional which with > the current setup around can never happen. Agree. IMO, strictly considering the leak, a cleanup for whatever is leaking would be better though. > I agree one can improve get_inferior_args in a way it no longer throws. > That would be another way to fix it. I do not mind which way the memory leak > of linux_nat_fill_prpsinfo gets fixed. -- Pedro Alves