This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] PR python/18565 - make Frame.function work for inline frames
- From: Tom Tromey <tom at tromey dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Wed, 22 Jun 2016 12:42:52 -0600
- Subject: Re: [RFA] PR python/18565 - make Frame.function work for inline frames
- Authentication-results: sourceware.org; auth=none
- References: <1466439050-11330-1-git-send-email-tom at tromey dot com> <86ziqfq6sz dot fsf at gmail dot com>
>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:
Yao> Tom Tromey <tom@tromey.com> writes:
>> TRY
>> {
>> + char *funname;
>> + enum language funlang;
>> +
>> FRAPY_REQUIRE_VALID (self, frame);
>>
>> - sym = find_pc_function (get_frame_address_in_block (frame));
>> + find_frame_funname (frame, &funname, &funlang, &sym);
>> + xfree (funname);
>> }
>> CATCH (except, RETURN_MASK_ALL)
>> {
Yao> Call xfree in CATCH block? Otherwise, patch is good to me.
I looked at this. I think it's probably better as-is.
My reasoning is that "funname" is initialized by the call to
find_frame_funname and isn't otherwise used. So, putting the free where
it appears now means that there is no gap between initialization and
free.
On the other hand if it is moved into the catch, then there have to be
two frees, one in the catch and one afterward.
So if it's ok with you, I'm inclined to leave it as-is.
Another option would be to change find_frame_funname to allow a NULL
argument here. Then this free would not be needed at all.
Let me know what you think.
Tom