Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH v6 3/3] gdb/dwarf: add cooked_index_entry::parent_is_deferred
Date: Thu, 24 Sep 2026 21:53:23 +0100	[thread overview]
Message-ID: <87v77u1id8.fsf@redhat.com> (raw)
In-Reply-To: <20260924151048.204777-4-simon.marchi@efficios.com>


This looks good to me.  But because I have to find something to earn my
pay...

Simon Marchi <simon.marchi@efficios.com> writes:

> Add a parent_is_deferred method to cooked_index_entry, mirroring
> name_is_deferred, and use it instead of checkingthe IS_PARENT_DEFERRED

... missing space in 'checkingthe'.

But otherwise, LGTM:

Approved-By: Andrew Burgess <aburgess@redhat.com>

thanks,
Andrew

> flag directly.
>
> Change-Id: Id684b30ec8aa81ac554e5c3edb8f7197c7238469
> ---
>  gdb/dwarf2/cooked-index-entry.h | 12 ++++++++----
>  gdb/dwarf2/cooked-index-shard.c | 10 +++++-----
>  gdb/dwarf2/cooked-index.c       |  2 +-
>  3 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/gdb/dwarf2/cooked-index-entry.h b/gdb/dwarf2/cooked-index-entry.h
> index 2637b8255258..462ec0640a9b 100644
> --- a/gdb/dwarf2/cooked-index-entry.h
> +++ b/gdb/dwarf2/cooked-index-entry.h
> @@ -224,17 +224,21 @@ struct cooked_index_entry : public allocate_on_obstack<cooked_index_entry>
>      return compare (canonical, other.canonical, SORT) < 0;
>    }
>  
> +  /* Return true if this entry's parent still has to be resolved.  */
> +  bool parent_is_deferred () const
> +  { return (flags & IS_PARENT_DEFERRED) != 0; }
> +
>    /* Set parent entry to PARENT.  */
>    void set_parent (const cooked_index_entry *parent)
>    {
> -    gdb_assert ((flags & IS_PARENT_DEFERRED) == 0);
> +    gdb_assert (!parent_is_deferred ());
>      m_parent_entry.resolved = parent;
>    }
>  
>    /* Resolve deferred parent entry to PARENT.  */
>    void resolve_parent (const cooked_index_entry *parent)
>    {
> -    gdb_assert ((flags & IS_PARENT_DEFERRED) != 0);
> +    gdb_assert (parent_is_deferred ());
>      flags = flags & ~IS_PARENT_DEFERRED;
>      m_parent_entry.resolved = parent;
>    }
> @@ -242,14 +246,14 @@ struct cooked_index_entry : public allocate_on_obstack<cooked_index_entry>
>    /* Return parent entry.  */
>    const cooked_index_entry *get_parent () const
>    {
> -    gdb_assert ((flags & IS_PARENT_DEFERRED) == 0);
> +    gdb_assert (!parent_is_deferred ());
>      return m_parent_entry.resolved;
>    }
>  
>    /* Return deferred parent entry.  */
>    parent_map::addr_type get_deferred_parent () const
>    {
> -    gdb_assert ((flags & IS_PARENT_DEFERRED) != 0);
> +    gdb_assert (parent_is_deferred ());
>      return m_parent_entry.deferred;
>    }
>  
> diff --git a/gdb/dwarf2/cooked-index-shard.c b/gdb/dwarf2/cooked-index-shard.c
> index af8c3e9527ac..206fe4483a40 100644
> --- a/gdb/dwarf2/cooked-index-shard.c
> +++ b/gdb/dwarf2/cooked-index-shard.c
> @@ -85,7 +85,7 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
>  				       parent_entry, per_cu);
>    m_entries.push_back (result);
>  
> -  if ((flags & IS_PARENT_DEFERRED) != 0)
> +  if (result->parent_is_deferred ())
>      m_have_deferred_parents = true;
>  
>    if (result->name_is_deferred ())
> @@ -109,8 +109,8 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
>       by language_may_use_plain_main as well), but it's handy as a spot
>       to document.  */
>    else if (lang != language_unknown
> -	   && (flags & IS_PARENT_DEFERRED) == 0
> -	   && parent_entry.resolved == nullptr
> +	   && !result->parent_is_deferred ()
> +	   && result->get_parent () == nullptr
>  	   && m_main == nullptr
>  	   && language_may_use_plain_main (lang)
>  	   && !result->name_is_deferred ()
> @@ -238,7 +238,7 @@ cooked_index_shard::resolve_deferred_parents
>    gdb_assert (m_have_deferred_parents);
>  
>    for (cooked_index_entry *entry : m_entries)
> -    if ((entry->flags & IS_PARENT_DEFERRED) != 0)
> +    if (entry->parent_is_deferred ())
>        {
>  	const cooked_index_entry *new_parent
>  	  = parent_maps->find (entry->get_deferred_parent ());
> @@ -308,7 +308,7 @@ cooked_index_shard::canonicalize_names ()
>    for (cooked_index_entry *entry : m_entries)
>      {
>        /* Deferred parents should not reach this point.  */
> -      gdb_assert ((entry->flags & IS_PARENT_DEFERRED) == 0);
> +      gdb_assert (!entry->parent_is_deferred ());
>  
>        /* Entries without a name are filtered out during the call to
>  	 prune_nameless_entries.  */
> diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
> index 96996ebc4603..89a93eff6998 100644
> --- a/gdb/dwarf2/cooked-index.c
> +++ b/gdb/dwarf2/cooked-index.c
> @@ -391,7 +391,7 @@ cooked_index::dump (gdbarch *arch)
>        gdb_printf ("    DIE offset: %s\n", sect_offset_str (entry->die_offset));
>        gdb_printf ("    CU index:   %u\n", entry->per_cu->index);
>  
> -      if ((entry->flags & IS_PARENT_DEFERRED) != 0)
> +      if (entry->parent_is_deferred ())
>  	gdb_printf ("    parent:     deferred (%" PRIx64 ")\n",
>  		    entry->get_deferred_parent ());
>        else if (entry->get_parent () != nullptr)
> -- 
> 2.55.0


  reply	other threads:[~2026-09-24 20:53 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 10:03 [PATCH] [GDB 18] gdb: resolve class name via DW_AT_signature in cooked index 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
2026-09-14 15:36             ` Tom Tromey
2026-09-10 16:18     ` Simon Marchi
2026-09-16 11:38     ` [PATCHv4] " Andrew Burgess
2026-09-22  4:26       ` Simon Marchi
2026-09-23 13:47         ` Simon Marchi
2026-09-24  4:59       ` [PATCH 0/2] " Simon Marchi
2026-09-24  5:05         ` Simon Marchi
2026-09-24 15:09         ` [PATCH v6 0/3] gdb/dwarf: " Simon Marchi
2026-09-24 15:09           ` [PATCH v6 1/3] gdb/dwarf: split cooked index finalization into separate steps Simon Marchi
2026-09-24 15:09           ` [PATCH v6 2/3] gdb/dwarf: resolve class name via DW_AT_signature in cooked index Simon Marchi
2026-09-24 15:09           ` [PATCH v6 3/3] gdb/dwarf: add cooked_index_entry::parent_is_deferred Simon Marchi
2026-09-24 20:53             ` Andrew Burgess [this message]
2026-09-25  2:34               ` Simon Marchi
2026-09-24  4:59       ` [PATCH 1/2] gdb: split cooked index finalization into separate steps Simon Marchi
2026-09-24 10:16         ` Andrew Burgess
2026-09-24 14:24           ` Simon Marchi
2026-09-24  4:59       ` [PATCH 2/2] gdb: resolve class name via DW_AT_signature in cooked index Simon Marchi
2026-09-24 10:39         ` Andrew Burgess
2026-09-24 15:07           ` Simon Marchi

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=87v77u1id8.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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