Re: [patch] [3/5] Types reference counting [make_function_type-objfile]

Jan Kratochvil
2009-05-01T14:44:56Z

On Thu, 16 Apr 2009 23:43:11 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> make_function_type was sometimes being called with permanent
> Jan> target type which would now also create a permanent function type
> Jan> while it should be objfile-associated function type instead.
>
> The only one is in jv-lang.c, right?

While jv-lang.c is also the case I originally found read_subroutine_type for
function returning void - where such DW_TAG_subprogram has no DW_AT_type
(return type) - and thus `builtin_type (gdbarch)->builtin_void' gets passed as
TYPE to make_function_type originally deriving the OBJFILE for its returned
function type from OBJFILE of that TYPE (internal in the void case).

> I'd like to understand why function types are always permanent, though.

This patch fixes only the real-OBJFILE vs. NULL-OBJFILE part which fixes the
leak even without the types reference counting / garbage collecting patch.

Whether NULL OBJFILE means permanent or discardable type I consider out of its
scope. You still can make it discardable by `type_init_group (function_type)'.

> This patch is ok.

Checked it in in its original form:
http://sourceware.org/ml/gdb-cvs/2009-05/msg00008.html

Thanks,
Jan