public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Simplify version check in dw2_symtab_iter_next
Date: Wed, 20 Apr 2022 15:12:22 +0000 (GMT)	[thread overview]
Message-ID: <20220420151222.6EDE9385737F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c1a56932c4b61f1fe81ce847cb40770203ffd16f

commit c1a56932c4b61f1fe81ce847cb40770203ffd16f
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Nov 22 16:50:46 2021 -0700

    Simplify version check in dw2_symtab_iter_next
    
    This simplifies the index versio check in dw2_symtab_iter_next, by
    passing a reference to the index object to this function.  This avoids
    an indirection via the per_bfd object.

Diff:
---
 gdb/dwarf2/read.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3053ec9b303..f340cd68e67 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2949,7 +2949,8 @@ dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
 /* Return the next matching CU or NULL if there are no more.  */
 
 static struct dwarf2_per_cu_data *
-dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
+dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
+		      mapped_index &index)
 {
   dwarf2_per_objfile *per_objfile = iter->per_objfile;
 
@@ -2963,9 +2964,8 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
 	 Indices prior to version 7 don't record them,
 	 and indices >= 7 may elide them for certain symbols
 	 (gold does this).  */
-      int attrs_valid =
-	(per_objfile->per_bfd->index_table->version >= 7
-	 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
+      int attrs_valid = (index.version >= 7
+			 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
 
       /* Don't crash on bad data.  */
       if (cu_index >= per_objfile->per_bfd->all_comp_units.size ())
@@ -3141,7 +3141,7 @@ dwarf2_gdb_index::expand_matching_symbols
       struct dwarf2_per_cu_data *per_cu;
 
       dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei);
-      while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
+      while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
 	dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
 					 nullptr);
       return true;


                 reply	other threads:[~2022-04-20 15:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220420151222.6EDE9385737F@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).