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] Let mapped index classes create the quick_symbol_functions object
Date: Wed, 20 Apr 2022 15:12:02 +0000 (GMT)	[thread overview]
Message-ID: <20220420151202.2C491385737B@sourceware.org> (raw)

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

commit 32ae6b930c293278c0a57d40c468653173ad09b5
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Mar 29 17:58:21 2021 -0600

    Let mapped index classes create the quick_symbol_functions object
    
    This changes the mapped index classes to create the
    quick_symbol_functions objects.  This is a step toward having a more
    abstract interface to mapped indices.

Diff:
---
 gdb/dwarf2/mapped-index.h |  4 ++++
 gdb/dwarf2/read.c         | 31 ++++++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h
index fb6828e43df..9f51a9e6578 100644
--- a/gdb/dwarf2/mapped-index.h
+++ b/gdb/dwarf2/mapped-index.h
@@ -77,6 +77,10 @@ struct mapped_index_base
     return false;
   }
 
+  /* Return a quick_symbol_functions instance that refers back to this
+     mapped_index_base.  */
+  virtual quick_symbol_functions_up make_quick_functions () const = 0;
+
   /* Build the symbol name component sorted vector, if we haven't
      yet.  */
   void build_name_components (dwarf2_per_objfile *per_objfile);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3f44c72565b..c0bb18a26f3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -243,6 +243,8 @@ struct mapped_index final : public mapped_index_base
 
   size_t symbol_name_count () const override
   { return this->symbol_table.size () / 2; }
+
+  quick_symbol_functions_up make_quick_functions () const override;
 };
 
 /* A description of the mapped .debug_names.
@@ -292,6 +294,8 @@ struct mapped_debug_names final : public mapped_index_base
 
   size_t symbol_name_count () const override
   { return this->name_count; }
+
+  quick_symbol_functions_up make_quick_functions () const override;
 };
 
 /* See dwarf2/read.h.  */
@@ -1887,8 +1891,14 @@ make_dwarf_gdb_index ()
   return quick_symbol_functions_up (new dwarf2_gdb_index);
 }
 
-static quick_symbol_functions_up
-make_dwarf_debug_names ()
+quick_symbol_functions_up
+mapped_index::make_quick_functions () const
+{
+  return quick_symbol_functions_up (new dwarf2_gdb_index);
+}
+
+quick_symbol_functions_up
+mapped_debug_names::make_quick_functions () const
 {
   return quick_symbol_functions_up (new dwarf2_debug_names_index);
 }
@@ -3494,6 +3504,11 @@ public:
     return m_symbol_table[idx];
   }
 
+  quick_symbol_functions_up make_quick_functions () const override
+  {
+    return nullptr;
+  }
+
 private:
   gdb::array_view<const char *> m_symbol_table;
 };
@@ -5281,7 +5296,8 @@ dwarf2_initialize_objfile (struct objfile *objfile)
   if (per_bfd->debug_names_table != nullptr)
     {
       dwarf_read_debug_printf ("re-using shared debug names table");
-      objfile->qf.push_front (make_dwarf_debug_names ());
+      objfile->qf.push_front
+	(per_bfd->debug_names_table->make_quick_functions ());
       return;
     }
 
@@ -5290,7 +5306,7 @@ dwarf2_initialize_objfile (struct objfile *objfile)
   if (per_bfd->index_table != nullptr)
     {
       dwarf_read_debug_printf ("re-using shared index table");
-      objfile->qf.push_front (make_dwarf_gdb_index ());
+      objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
       return;
     }
 
@@ -5304,7 +5320,8 @@ dwarf2_initialize_objfile (struct objfile *objfile)
   if (dwarf2_read_debug_names (per_objfile))
     {
       dwarf_read_debug_printf ("found debug names");
-      objfile->qf.push_front (make_dwarf_debug_names ());
+      objfile->qf.push_front
+	(per_bfd->debug_names_table->make_quick_functions ());
       return;
     }
 
@@ -5313,7 +5330,7 @@ dwarf2_initialize_objfile (struct objfile *objfile)
 			     get_gdb_index_contents_from_section<dwz_file>))
     {
       dwarf_read_debug_printf ("found gdb index from file");
-      objfile->qf.push_front (make_dwarf_gdb_index ());
+      objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
       return;
     }
 
@@ -5324,7 +5341,7 @@ dwarf2_initialize_objfile (struct objfile *objfile)
     {
       dwarf_read_debug_printf ("found gdb index from cache");
       global_index_cache.hit ();
-      objfile->qf.push_front (make_dwarf_gdb_index ());
+      objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
       return;
     }


                 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=20220420151202.2C491385737B@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).