From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] PR python/18565 - make Frame.function work for inline frames
Date: Wed, 03 Aug 2016 08:07:00 -0000 [thread overview]
Message-ID: <CAH=s-PNVbSsvus_E2wJ+OcqGyZEhC-hkwR2hQxvzP3MRjGGy_w@mail.gmail.com> (raw)
In-Reply-To: <d861e87d-a94d-5ae9-5d51-3f7f8ad0ccc1@redhat.com>
On Mon, Jul 25, 2016 at 12:04 PM, Pedro Alves <palves@redhat.com> 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_funname
frees the memory on exception.
>
> So I think that it's find_frame_funname that should be responsible for making
> 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.
--
Yao (齐尧)
next prev parent reply other threads:[~2016-08-03 8:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 16:11 Tom Tromey
[not found] ` <86ziqfq6sz.fsf@gmail.com>
2016-06-22 18:43 ` Tom Tromey
2016-07-25 10:23 ` Yao Qi
2016-07-25 11:04 ` Pedro Alves
2016-07-25 15:01 ` Tom Tromey
2016-07-26 11:14 ` Pedro Alves
2016-07-26 13:18 ` Tom Tromey
2016-07-26 14:33 ` Pedro Alves
2016-08-03 8:15 ` Yao Qi
2016-08-03 15:14 ` Tom Tromey
2016-08-03 17:57 ` Pedro Alves
2016-08-03 8:07 ` Yao Qi [this message]
2016-08-03 11:35 ` Pedro Alves
2016-08-03 13:15 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH=s-PNVbSsvus_E2wJ+OcqGyZEhC-hkwR2hQxvzP3MRjGGy_w@mail.gmail.com' \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox