Introduce class psymtab_storage
[deliverable/binutils-gdb.git] / gdb / objfiles.h
index c0fc36f087c065e5993791cc7bf9ac73c99b9b3e..94b415c4e07268a0e9aba548d1204719329a559e 100644 (file)
@@ -27,6 +27,7 @@
 #include "progspace.h"
 #include "registry.h"
 #include "gdb_bfd.h"
+#include "psymtab.h"
 #include <vector>
 #include "common/next-iterator.h"
 #include "common/safe-iterator.h"
@@ -321,22 +322,9 @@ struct objfile
 
   struct compunit_symtab *compunit_symtabs = nullptr;
 
-  /* Each objfile points to a linked list of partial symtabs derived from
-     this file, one partial symtab structure for each compilation unit
-     (source file).  */
+  /* The partial symbol tables.  */
 
-  struct partial_symtab *psymtabs = nullptr;
-
-  /* Map addresses to the entries of PSYMTABS.  It would be more efficient to
-     have a map per the whole process but ADDRMAP cannot selectively remove
-     its items during FREE_OBJFILE.  This mapping is already present even for
-     PARTIAL_SYMTABs which still have no corresponding full SYMTABs read.  */
-
-  struct addrmap *psymtabs_addrmap = nullptr;
-
-  /* List of freed partial symtabs, available for re-use.  */
-
-  struct partial_symtab *free_psymtabs = nullptr;
+  std::shared_ptr<psymtab_storage> partial_symtabs;
 
   /* The object file's BFD.  Can be null if the objfile contains only
      minimal symbols, e.g. the run time common symbols for SunOS4.  */
@@ -358,22 +346,11 @@ struct objfile
 
   struct obstack objfile_obstack {};
 
-  /* A byte cache where we can stash arbitrary "chunks" of bytes that
-     will not change.  */
-
-  struct psymbol_bcache *psymbol_cache;
-
   /* Map symbol addresses to the partial symtab that defines the
      object at that address.  */
 
   std::vector<std::pair<CORE_ADDR, partial_symtab *>> psymbol_map;
 
-  /* 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;
-
   /* Structure which keeps track of functions that manipulate objfile's
      of the same type as this objfile.  I.e. the function to read partial
      symbols for example.  Note that this structure is in statically
@@ -697,6 +674,19 @@ private:
   struct objfile *m_objfile;
 };
 
+/* A range adapter that makes it possible to iterate over all
+   psymtabs in one objfile.  */
+
+class objfile_psymtabs : public next_adapter<struct partial_symtab>
+{
+public:
+
+  explicit objfile_psymtabs (struct objfile *objfile)
+    : next_adapter<struct partial_symtab> (objfile->partial_symtabs->psymtabs)
+  {
+  }
+};
+
 #define ALL_OBJFILE_OSECTIONS(objfile, osect)  \
   for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
     if (osect->the_bfd_section == NULL)                                        \
This page took 0.037206 seconds and 4 git commands to generate.