Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>,
	 Andrew Burgess <aburgess@redhat.com>,
	Sendao Yan <yansendao@126.com>,
	 gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/symtab] Fall back to symtabs when the quick lookup misses
Date: Sat, 21 Nov 2026 09:31:28 -0700	[thread overview]
Message-ID: <874idarvrz.fsf@tromey.com> (raw)
In-Reply-To: <111d5ee6-2113-408b-8880-e73f2cdf0865@simark.ca> (Simon Marchi's message of "Fri, 20 Nov 2026 22:53:16 -0500")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> Strictly speaking, S<1> and S<1l> mean two different types.  One has
Simon> an "int" template parameter and the other a "long int" template
Simon> parameter.  I don't think it would make sense for them to canonicalize
Simon> to the same thing, as (1) the conversion would be lossy and (2) the
Simon> type names would become ambiguous.  I think that what we want is... more
Simon> approximate/fuzzy matching.

I don't truly dislike fuzzy matching; but what I do strongly dislike is
strcmp_iw, which is basically C++-isms getting into the gdb core.

I'd prefer that the symbol tables be dumber and, if necessary, the logic
be pushed into the C++ parser or some other place where it doesn't
require the core of gdb to have language-specific treatment.

I tend to think that instead of "lookup", gdb would be better if access
to the symtabs looked more like iteration.  Then the C++ parser could do
whatever weird stuff it needs -- in the C++ support files.

This could maybe be done with some kind of callback thing instead.

This would solve the best_symbol thing as well.

Simon>  - gcc does not put the integer suffix, so gives it DW_AT_name "S<1>"
Simon>  - clang puts the integer suffix, so gives it DW_AT_name "S<1L>"

Simon> So the cooked index contains either "S<1>" or "S<1L>", depending on the
Simon> compiler.  Knowing this, we want lookups of either "S<1>" or "S<1L>" to
Simon> work, because they are both legitimate queries.  How do we achieve that?

Simon> It does sound tempting to just canonicalize everything to "S<1>" (i.e.
Simon> drop the suffixes), but then what if you have both "S<1>" and "S<1L>" in
Simon> your program, how do you differentiate them?  Perhaps it's fine for the
Simon> index to store "simplified" names that don't include the suffixes,
Simon> but I wouldn't call that a "canonical" name.

Yeah, that's a real problem.  I think you hit on a solution below.

Simon> Regarding the DW_AT_names given by gcc: given that they lack potentially
Simon> crucial information to know the type of the value parameters, maybe we
Simon> should consider rebuilding the names from the
Simon> DW_TAG_template_value_parameter DIEs.

We already need to do this due to -gsimple-template-names.  Relevant
bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=30023
https://sourceware.org/bugzilla/show_bug.cgi?id=32421

Tom

  reply	other threads:[~2026-11-21 16:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:18 Sendao Yan
2026-11-20 18:26 ` Andrew Burgess
2026-11-20 19:46   ` Keith Seitz
2026-11-21  0:50   ` Tom Tromey
2026-11-21  3:53     ` Simon Marchi
2026-11-21 16:31       ` Tom Tromey [this message]
2026-11-22 12:03         ` [PATCH v3 0/1] [gdb/symtab] Add canonical-name aliases for C++ template static members Sendao Yan
2026-11-22 12:03           ` [PATCH v3 1/1] " Sendao Yan
2026-11-23  2:09           ` [PATCH v4 0/1] " Sendao Yan
2026-11-23  2:09             ` [PATCH v4 1/1] " Sendao Yan
2026-11-21 14:59 ` [PATCH v2] " Sendao Yan
2026-11-21 15:07   ` Sendao Yan

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=874idarvrz.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=yansendao@126.com \
    /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