This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] PR python/18565 - make Frame.function work for inline frames


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]