Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: Sendao Yan <yansendao@126.com>,
	 gdb-patches@sourceware.org, tom@tromey.com
Subject: Re: [PATCH] [gdb/symtab] Fall back to symtabs when the quick lookup misses
Date: Fri, 20 Nov 2026 17:50:22 -0700	[thread overview]
Message-ID: <87bj7jros1.fsf@tromey.com> (raw)
In-Reply-To: <xhuyfse0v2wcm.fsf@aburgess-thinkpadp1gen8.rmtgb.csb> (Andrew Burgess's message of "Fri, 20 Nov 2026 18:26:01 +0000")

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> +      /* The cooked index does not necessarily contain every symbol that
>> +	 the expanded symtabs do.  In particular, GCC emits a DWARF5
>> +	 DW_TAG_variable for a static constexpr member using the DWARF
>> +	 spelling of the enclosing template arguments (e.g.
>> +	 std::ratio<1, 1>), while the C++ expression evaluator looks the
>> +	 member up using the canonical spelling (std::ratio<1l, 1l>), so
>> +	 the quick lookup misses it.  Fall back to walking the symtabs,
>> +	 which was the behaviour before commit 86ac8c546235.
>> +
>> +	 PR symtab/33533.  */
>> +      result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
>> +						 name, domain);

I don't think we want to go back to doing this.  I hate to NAK a patch
but I think I will have to for this one.

Andrew> My concern here is that if you *rely* on finding symbols in the expanded
Andrew> symtabs, then the lookup only works if something else first expands the
Andrew> symtab.  This means we have random bugs where things don't work, then
Andrew> they'll suddenly start working (once the symtab has expanded).

... and this is why.  This was basically the reason for commit
86ac8c546235.

I think the fix has to involve the lookup succeeding in the cooked
index.

One question I have is why the name isn't canonicalized in the cooked
index, or to put it another way, why the C++ expression lookup and the
cooked index disagree -- since the idea behind canonicalization is that
there's a single spelling.

thanks
Tom

  parent reply	other threads:[~2026-11-21  0:50 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 [this message]
2026-11-21  3:53     ` Simon Marchi
2026-11-21 16:31       ` Tom Tromey
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=87bj7jros1.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --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