From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27154 invoked by alias); 3 Aug 2016 08:07:36 -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 26962 invoked by uid 89); 3 Aug 2016 08:07:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 03 Aug 2016 08:07:32 +0000 Received: by mail-oi0-f47.google.com with SMTP id j185so269893747oih.0 for ; Wed, 03 Aug 2016 01:07:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=lE8F8K7xiFDJTP+9go1ZPAl3sIzoJj7WVCUjwa79cGo=; b=GPlFVQ3dgaeD5rMXJ1qWSAuU/PkoSVnk54MTiKRNLsNp783hJNUdfR8potwJYOYWWf 8zykL0RAR3BGBfRiLGhJOE9LUIVBcQjebfyqF87fDqV9WckPiOga8c479sA2yxpaevz6 kTc70JEWI7+/J9frs7S7e7wlEJl8ZE+m97aVeuPkIaXnowD3y7nO/+L8w4oDm6/KeWU/ TAo75FuYhxp45TSQYT9Kmd0l/M4jiFVfKusoK+7IA2OoN06UDBYYM08rLD8t8N/VPC8f 5aCyUpDe20O0W3dEEb4fj7kDnVFrIL6F5mV7WEU0zztmZc8ff6UGIr37fnbcsXwSGWRy kjYg== X-Gm-Message-State: AEkoouso0ZhDf61tMDSQdXNL3jYNg3khVrJ5TM519XDANVCTBKchyri4g1SN6M/xlv/dKJ16Pm8OB3sZ/uQAlg== X-Received: by 10.157.17.227 with SMTP id y32mr38859604oty.101.1470211650315; Wed, 03 Aug 2016 01:07:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.172.75 with HTTP; Wed, 3 Aug 2016 01:07:29 -0700 (PDT) In-Reply-To: References: <1466439050-11330-1-git-send-email-tom@tromey.com> <86ziqfq6sz.fsf@gmail.com> <8737o5kqtv.fsf@tromey.com> From: Yao Qi Date: Wed, 03 Aug 2016 08:07:00 -0000 Message-ID: Subject: Re: [RFA] PR python/18565 - make Frame.function work for inline frames To: Pedro Alves Cc: Tom Tromey , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00047.txt.bz2 On Mon, Jul 25, 2016 at 12:04 PM, Pedro Alves wrote: >> >> The reason I suggested that way is that the exception may be thrown out = in >> find_frame_funname after the memory is allocated for funname, so we need >> xfree in CATCH, and also need xfree afterwards. > > I disagree. In general, I think that up until the called function does a= normal What do you disagree on? > return, the memory for output parameters is owned by the called function. > A normal return then transfers ownership of the output parameters' memory > to the caller. Yes, so we need xfree after find_frame_funname on normal return. That is what I suggested. We need to free the memory referenced by output parameter when exception is thrown too. The point in question is that who is responsible to free the memory referenced by output parameter. In Tom's patch, they are freed in the caller in normal return, so it is reasonable to free them in the caller= in exception return as well, because it is not specified that find_frame_funna= me frees the memory on exception. > > So I think that it's find_frame_funname that should be responsible for ma= king > sure that memory for output parameters is cleaned up on exception, or be > written in a way that never throws after the memory allocation, which it = may be > already, but I haven't checked in detail. > If you think it is find_frame_funname's responsibility to free memory on exception, that is fine. We should document this behaviour for find_frame_funname and guarantee that find_frame_funname behaves that way. However, we are not sure current find_frame_funname behaves that way, because exception may be thrown in cp_remove_params. --=20 Yao (=E9=BD=90=E5=B0=A7)