gdb: add field::name / field::set_name
[binutils-gdb.git] / gdb / psymtab.h
index d66547418cb91c40c118b8bb2e174694051a6377..7cd3e95b179b6683233351f9d99e488638746a7b 100644 (file)
@@ -1,6 +1,6 @@
 /* Public partial symbol table definitions.
 
-   Copyright (C) 2009-2020 Free Software Foundation, Inc.
+   Copyright (C) 2009-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
 struct partial_symbol;
 
+/* Specialization of bcache to store partial symbols.  */
+
+struct psymbol_bcache : public gdb::bcache
+{
+  /* Calculate a hash code for the given partial symbol.  The hash is
+     calculated using the symbol's value, language, domain, class
+     and name.  These are the values which are set by
+     add_psymbol_to_bcache.  */
+  unsigned long hash (const void *addr, int length) override;
+
+  /* Returns true if the symbol LEFT equals the symbol RIGHT.
+     For the comparison this function uses a symbols value,
+     language, domain, class and name.  */
+  int compare (const void *left, const void *right, int length) override;
+};
+
 /* An instance of this class manages the partial symbol tables and
    partial symbols for a given objfile.
 
@@ -36,7 +52,9 @@ struct partial_symbol;
    other memory managed by this class), or on the per-BFD object.  The
    only link from the psymtab storage object back to the objfile (or
    objfile_obstack) that is made by the core psymtab code is the
-   compunit_symtab member in the psymtab.
+   compunit_symtab member in the standard_psymtab -- and a given
+   symbol reader can avoid this by implementing its own subclasses of
+   partial_symtab.
 
    However, it is up to each symbol reader to maintain this invariant
    in other ways, if it wants to reuse psymtabs across multiple
@@ -46,9 +64,7 @@ struct partial_symbol;
 class psymtab_storage
 {
 public:
-
-  psymtab_storage ();
-
+  psymtab_storage () = default;
   ~psymtab_storage ();
 
   DISABLE_COPY_AND_ASSIGN (psymtab_storage);
@@ -88,7 +104,7 @@ public:
 
   void install_psymtab (partial_symtab *pst);
 
-  typedef next_adapter<struct partial_symtab> partial_symtab_range;
+  using partial_symtab_range = next_range<partial_symtab>;
 
   /* A range adapter that makes it possible to iterate over all
      psymtabs in one objfile.  */
@@ -119,13 +135,7 @@ public:
   /* A byte cache where we can stash arbitrary "chunks" of bytes that
      will not change.  */
 
-  gdb::bcache psymbol_cache;
-
-  /* Vectors of all partial symbols read in from file.  The actual data
-     is stored in the objfile_obstack.  */
-
-  std::vector<partial_symbol *> global_psymbols;
-  std::vector<partial_symbol *> static_psymbols;
+  psymbol_bcache psymbol_cache;
 
 private:
 
@@ -135,18 +145,4 @@ private:
   gdb::optional<auto_obstack> m_obstack;
 };
 
-
-extern const struct quick_symbol_functions psym_functions;
-
-extern const struct quick_symbol_functions dwarf2_gdb_index_functions;
-extern const struct quick_symbol_functions dwarf2_debug_names_functions;
-
-/* Ensure that the partial symbols for OBJFILE have been loaded.  If
-   VERBOSE is true, then this will print a message when symbols
-   are loaded.  This function returns a range adapter suitable for
-   iterating over the psymtabs of OBJFILE.  */
-
-extern psymtab_storage::partial_symtab_range require_partial_symbols
-    (struct objfile *objfile, bool verbose);
-
 #endif /* PSYMTAB_H */