Don't trust templates from DW_AT_name
With gcc 8 (and clang?) the non-type template arguments (constants)
don't include the integer suffixes anymore. For example, with
template <unsigned int X>
class foo
{
...
};
foo<10u>
used to generate foo<10u> as the DW_AT_name, now it generates foo<10>.
This is a problem when things look up "foo<10u>" and don't find it. For
example, when trying to print an instance of that class through a base
class pointer, GDB would first demangle the symbol for that class'
vtable, which would give "vtable for foo<10u>". GDB would then take the
"foo<10u>" from that string and try to look up the type. With the new
DW_AT_name, it would fail to look it up, and fail to print the value.
This patch makes it so GDB doesn't trust the templates contained in
DW_AT_name. Instead, it re-builds the name from the DW_AT_template_*
DIES in the format that it expects (with the integer suffixes).
4 files changed