Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Simon Marchi <simark@simark.ca>, Tom Tromey <tom@tromey.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCHv3] gdb: resolve class name via DW_AT_signature in cooked index
Date: Wed, 16 Sep 2026 12:48:13 +0100	[thread overview]
Message-ID: <87tsnpbeo2.fsf@redhat.com> (raw)
In-Reply-To: <87y0d2v9rt.fsf@tromey.com>

Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
>>> We would have to delete the name-less entries, and any child
>>> entry that refers to them, not sure how to do that efficiently though.
>
> Andrew> This is the problem I'm currently trying to solve.
>
> Andrew> The problem with this approach is that the parent might be from another
> Andrew> shard, potentially resolved due to the IS_PARENT_DEFERRED flag from the
> Andrew> parent map.  The race is on the read of the parent's name field, the
> Andrew> parent might appear nameless, but it might in fact be the case that the
> Andrew> name hasn't been assigned yet.
>
> Andrew> The other possibility is that, because this is an error case, we could
> Andrew> have a serial action that cleans up the mess, deleting child entries
> Andrew> with nameless parents.  This would be done in
> Andrew> cooked_index::set_contents, as part of this code:
>
> Right now your patch is fixing up these entries in parallel, in each
> shard.  But if this is uncommon enough, it could be done in
> cooked_index::set_contents instead, say when setting up the finalizer
> tasks:
>
>   for (auto &shard : m_shards)
>     {
>       auto this_shard = shard.get ();
>       const parent_map_map *parent_maps = m_state->get_parent_map_map ();
> ... signature->entry lookup here
>
> Then entries could be filtered out in cooked_index_shard::finalize if
> they have a "bad" parent somewhere in their "parent" chain.
>
> I'm not sure if this would work or not.  TBH I find all this stuff in
> DWARF pretty maddening and also difficult to reason about.  Like, even
> constructing the case you are talking about seems very tricky, seeing
> that it has to involve type signatures and somehow also cross-CU parent
> references.
>
>
> A different option might be to ignore such entries at lookup time.  That
> is, let the child entries stay in the vector and just skip them in the
> relevant lookup loops.  My intuition generally is that DWARF reading is
> slow and user-visible, as is CU expansion -- but the lookups themselves
> are not.
>
> This would probably just mean touching the index writers and
> cooked_index_functions::search.  Perhaps the bad entries themselves (an
> entry with a signature that couldn't be found) could simply not appear
> in the shard vector, to avoid problems with their anonymity.
>
> In cooked_index_functions::search you could just stick a check here:
>
> 	  if (!entry->matches (search_flags)
> 	      || !entry->matches (domain))
> 	    continue;
>
> Like "entry->valid () || ..."
>
>
> I have no idea if this is helpful but didn't want to leave you hanging.
> I'm sorry you have to deal with this.

Not a problem, and it's good to learn more about this part of GDB that
I've previously not worked on much.

I'd already written v4 before I read this email, so I've not taken all
your suggestions on board, that's not because I don't value them, but
I'd already written some code which I think is OK, even if it's not
exactly what you're suggesting here.

I'd value your thoughts on the v4 patch, and if you see problems then
I'll take another pass through this email and do something more along
these lines.

Thanks,
Andrew


  parent reply	other threads:[~2026-09-16 11:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 10:03 [PATCH] [GDB 18] " Andrew Burgess
2026-08-21 17:07 ` Tom Tromey
2026-08-28 21:30 ` [PATCHv2] " Andrew Burgess
2026-09-01 13:31   ` [PATCHv3] " Andrew Burgess
2026-09-10 16:11     ` Simon Marchi
2026-09-11 19:18       ` Tom Tromey
2026-09-12  2:06         ` Simon Marchi
2026-09-14 13:23           ` Andrew Burgess
2026-09-14 14:57             ` Simon Marchi
2026-09-14 15:38               ` Tom Tromey
2026-09-15 10:25               ` Andrew Burgess
2026-09-15 15:01                 ` Tom Tromey
2026-09-15 15:55                   ` Simon Marchi
2026-09-15 17:21                     ` Simon Marchi
2026-09-16 11:40                       ` Andrew Burgess
2026-09-16 11:45                     ` Andrew Burgess
2026-09-16 11:48                   ` Andrew Burgess [this message]
2026-09-14 15:36             ` Tom Tromey
2026-09-10 16:18     ` Simon Marchi
2026-09-16 11:38     ` [PATCHv4] " Andrew Burgess

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=87tsnpbeo2.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.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