This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add method overload resolution to expression parser
- From: Daniel Jacobowitz <drow at false dot org>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Keith Seitz <keiths at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 14 Oct 2009 15:17:10 -0400
- Subject: Re: [RFA] Add method overload resolution to expression parser
- References: <4A9D628B.1070300@redhat.com> <20091013212426.GA26169@caradoc.them.org> <m3zl7tajs8.fsf@fleche.redhat.com>
On Wed, Oct 14, 2009 at 12:54:15PM -0600, Tom Tromey wrote:
> This implementation defers creation of the temporary function type to
> the point where it is used. IIUC, which I hope I do :-), this temporary
> type can't really leak out of the TYPE_INSTANCE code. That is, it is
> constructed and used to look up an actual function or method (which has
> its own type).
>
> If we used UNOP_CAST then we would have to make a long-lived temporary
> type, not only because the type would have to live at least from parsing
> through the end of the life of the parsed expression, but also because
> the result of the cast would have that temporary type, and thus it would
> be capturable.
>
> This would not be as big a deal if the type GC work were finished, but
> that is still pending.
Maybe we need to get that merged, then, instead of complicated
lifetime-confusing hacks around it :-)
We already have related bugs (and memory leaks). Try:
(gdb) ptype (int (*) (int, int)) 0
type = int (*)()
We lose the arguments - but we still call make_function_type, and leak
the type. So it's clear to me that we want a more general solution.
--
Daniel Jacobowitz
CodeSourcery