Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Blaikie via Gdb <gdb@sourceware.org>
To: Simon Marchi <simark@simark.ca>
Cc: gdb <gdb@sourceware.org>
Subject: Re: Decl/def matching with templates without template parameters in the DW_AT_name
Date: Wed, 18 Jan 2023 14:04:30 -0800	[thread overview]
Message-ID: <CAENS6EtxgKys5HcO07tRndgo_kdTg_mmxq2FqABDFBxXFeDG=Q@mail.gmail.com> (raw)
In-Reply-To: <afe469ca-ac7d-365d-62ee-9097667571e4@simark.ca>

On Wed, Jan 11, 2023 at 6:32 PM Simon Marchi <simark@simark.ca> wrote:
>
> > Yeah, this is a case where DWARF is like "here are some tools you
> > could use to express some language features, have at!" and doesn't say
> > "to describe this particular language feature you must use DWARF in
> > this particular way"
> I just found this:
>
> http://wiki.dwarfstd.org/index.php?title=Best_Practices#Names_of_Program_Entities
>
>     For template instantiations, the DW_AT_name attribute should contain
>     both the source language name of the object and the template
>     parameters that distinguish one instantiation from another. The
>     resulting string should be in the natural form for the language, and
>     should have a canonical representation (i.e., different producers
>     should generate the same representation). For C++, the string should
>     match that produced by the target platform's canonical demangler;
>     spaces should only be inserted where syntactically required by the
>     compiler.
>
> Of course, it's not normative.  According to the wiki history, this
> particular bit was added by Cary Coutant, in case you want to ask him
> why it is considered best practice.
>
> I Googled bits of the previous quote, and found this bug about template
> string canonicalization, and not including template parameters in the
> string:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94845#c8
>
> And this one, that sounds like the 2 vs 2u thing I talked about earler:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81932
>
> Ah, and the thread that was on the GDB list about that:
>
> https://inbox.sourceware.org/gdb/CAATAM3ED7B3wEJFmaZA_MaOtN5EGKSGFmusAf-Mg5hX35D2r6A@mail.gmail.com/
>
> And the corresponding one on llvm-dev, to which you participated:
>
> https://lists.llvm.org/pipermail/llvm-dev/2018-March/121541.html
>
> It's not all relevant, but I re-read those to remember what the trouble
> with the name strings with template parameters was.
>
> My thought on all this is that if the name strings with template
> parameters are not reliable and take a lot of space, and the same
> information is described in a more structured way (as DIEs), then it
> makes sense to drop the parameters from the string.

Yeah, though I'll be the first to admit that the DIEs aren't perfect
either - there's a bunch of cases I opted out of the name
simplification (keeping their full name) because the DIEs weren't
adequate to reproduce the original name (in an effort to be
conservatively correct - in some cases it's the original name that's
the problem (some of those I fixed, some were too complex for me to
fix immediately, so I punted on them and kept the unsimplified name) -
lambdas, operator overloads come to mind, but there were some others).

It'd be good to get those DIE issues fixed, imho & then be able to
rely on simplified names uniformly.

(also as I mentioned in the bug I filed about the simplified names +
index, there's a bunch of inconsistencies here with both Clang and GCC
about alias templates and variable templates, as to whether they get
simplified or unsimplified names and whether they get DIEs or not...
:/ )

      reply	other threads:[~2023-01-18 22:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 17:37 David Blaikie via Gdb
2023-01-11 18:24 ` Simon Marchi via Gdb
2023-01-11 23:50   ` David Blaikie via Gdb
2023-01-12  1:46     ` Simon Marchi via Gdb
2023-01-14 20:28       ` Tom Tromey
2023-01-16 21:18         ` Simon Marchi via Gdb
2023-01-18 22:08           ` David Blaikie via Gdb
2023-01-18 22:12         ` David Blaikie via Gdb
2023-01-18 22:01       ` David Blaikie via Gdb
2023-01-12  2:32     ` Simon Marchi via Gdb
2023-01-18 22:04       ` David Blaikie via Gdb [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAENS6EtxgKys5HcO07tRndgo_kdTg_mmxq2FqABDFBxXFeDG=Q@mail.gmail.com' \
    --to=gdb@sourceware.org \
    --cc=dblaikie@gmail.com \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox