Re: Decl/def matching with templates without template parameters in the DW_AT_name
David Blaikie via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAENS6EvW1M5eh-i3a5tFu_HEnN+wPdwZS6xVaxZYVd09a8=RFA@mail.gmail.com> |
On Wed, Jan 11, 2023 at 5:46 PM Simon Marchi <[email protected]> wrote: > Digging in the history leads me to: > > https://inbox.sourceware.org/gdb-patches/[email protected]/ > > 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: https://godbolt.org/z/r8zMf5qvr 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: https://sourceware.org/bugzilla/show_bug.cgi?id=30023 ) 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: https://github.com/llvm/llvm-project/blob/main/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp - 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...