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]

[RFA] [python] Fix field list of typedef regression


On Sat, Oct 29, 2011 at 12:12 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> Question: What's the right way to handle ref counting here?
>
> Doug> + ? ? ?CHECK_TYPEDEF (checked_type);
> Doug> + ? ? ?if (checked_type != type)
> Doug> + ? ? ? ?self = type_to_type_object (checked_type);
> Doug> + ? ? ?/* FIXME: reference counting of self? */
>
> type_to_type_object returns a new reference.
> So the caller is responsible for decref'ing it.
>
> I think assigning to self is unexpected.
>
> Doug> + ? ?}
> Doug> + ?GDB_PY_HANDLE_EXCEPTION (except);
>
> I'd pull the type_to_type_object call out of the TRY_CATCH.
> Then you don't have to handle a decref on the exception return.
>
> Tom
>

Thanks.
I think this gets the ref-counting correct.
I singlestepped through it and it looked ok anyways.

Ok to check in?

2011-11-10  Doug Evans  <dje@google.com>

        * python/py-type.c (typy_fields_items): Call check_typedef.

        testsuite/
        * gdb.python/py-type.c (TS): New typedef.
        (ts): New global.
        * gdb.python/py-type.exp: Test field list of typedef.

Attachment: gdb-111110-py-type-typedef-2.patch.txt
Description: Text document


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