This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [3/5] Types reference counting [make_function_type-objfile]
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 1 May 2009 16:44:40 +0200
- Subject: Re: [patch] [3/5] Types reference counting [make_function_type-objfile]
- References: <20090411102152.GD32624@host0.dyn.jankratochvil.net> <m3d4bccm1c.fsf@fleche.redhat.com>
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