Re: gdb.cp/templates.exp, ctor/dtor breakpoints, etc....

Daniel Jacobowitz
2009-01-19T15:56:08Z

On Mon, Jan 19, 2009 at 04:30:31PM +0100, Christophe LYON wrote:
> But... if GDB does not rely on mangled names, how is it supposed to find
> the right template instantiation when trying to set a breakpoint on a
> function? For instance in templates.exp, where the T5 template is
> defined, how to find the T5<int> ctor, if all the ctor instantiations are
> named "T5" ? Should GDB analyse all the type definition in .debug_info and
> find the right type?

They're all named T5<X>::T5 for some X. We get fully qualified type
names in the debug info. The function should be contained in or
specified by the containing type.

Admittedly, for some template cases this gets really out of hand.
It's *hard* to represent Template<Type::Bar, 5, &(static_var)> as the
name of a type in DWARF. But this can all be done using DW_AT_name;
it only gets really tricky if the compiler uses the DWARF extensions
for type and value parameters.