Decl/def matching with templates without template parameters in the DW_AT_name

David Blaikie
Wed Jan 18 22:01:35 GMT 2023

On Wed, Jan 11, 2023 at 5:46 PM Simon Marchi <> wrote:
> Digging in the history leads me to:
> So RVCT, the RealView compiler.  I don't have access to that,
> unfortunately.  It seems obsolete, also.

Oh, that's satisfying/interesting to know - figured /someone/ had done
this before, judging by gdb's behavior.

> If you end up merging this, it will be interesting to run the full GDB
> testsuite against clang with that flag, it would cover a lot of things.

Oh, it's already in Clang, under `-gsimple-template-names`, I think
even Clang 15's functionality is well baked enough - I finished up the
work about a year ago now. Here's a very small example: showing the shortened name in the
.debug_info, and in the .debug_gdb_pubnames (which ends up in the
index, which turns out was the bug I came across... filed here: )

As I mentioned, though, there's a bunch of cases where Clang doesn't
simplify names because they don't roundtrip well/DWARF is
lossy/problematic in some way in the way it describes the template
parameters. Some of the interesting (positive and negative/simplified
and unsimplified) test cases I encountered were:
- this checks that I could easily rebuild the original name from
llvm-dwarfdump. So, things like templates with lambda parameters
aren't simplified because there isn't necessarily enough info to
rebuild the name as clang generates them (also GCC generates those
names differently - and those are probably harder to roundtrip, but
more likely to be canonical/unique/unambiguous), operator overloads
were not simplified because it was hard to tell if they were/weren't
simplified with all the <> involved in some operator names even
without template parameters - etc...

More information about the Gdb mailing list