bfd_set_input_error
[deliverable/binutils-gdb.git] / gdb / psympriv.h
index 006e1344271c87ce8a6c8d314ecc822bf2836601..c4d2bb9ec6d8e64f28ff75e5369779763f830e0e 100644 (file)
@@ -1,6 +1,6 @@
 /* Private partial symbol table definitions.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,6 +21,7 @@
 #define PSYMPRIV_H
 
 #include "psymtab.h"
+#include "objfiles.h"
 
 struct psymbol_allocation_list;
 
@@ -28,7 +29,7 @@ struct psymbol_allocation_list;
    symbols whose types we have not parsed yet.  For functions, it also
    contains their memory address, so we can find them from a PC value.
    Each partial_symbol sits in a partial_symtab, all of which are chained
-   on a  partial symtab list and which points to the corresponding 
+   on a  partial symtab list and which points to the corresponding
    normal symtab once the partial_symtab has been referenced.  */
 
 /* This structure is space critical.  See space comments at the top of
@@ -36,21 +37,19 @@ struct psymbol_allocation_list;
 
 struct partial_symbol
 {
-
   /* The general symbol info required for all types of symbols.  */
 
   struct general_symbol_info ginfo;
 
   /* Name space code.  */
 
-  ENUM_BITFIELD(domain_enum_tag) domain : 6;
+  ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS;
 
   /* Address class (for info_symbols).  Note that we don't allow
      synthetic "aclass" values here at present, simply because there's
      no need.  */
 
-  ENUM_BITFIELD(address_class) aclass : 6;
-
+  ENUM_BITFIELD(address_class) aclass : SYMBOL_ACLASS_BITS;
 };
 
 #define PSYMBOL_DOMAIN(psymbol)        (psymbol)->domain
@@ -79,7 +78,6 @@ enum psymtab_search_status
 
 struct partial_symtab
 {
-
   /* Chain of all existing partial symtabs.  */
 
   struct partial_symtab *next;
@@ -98,12 +96,6 @@ struct partial_symtab
 
   const char *dirname;
 
-  /* Set of relocation offsets to apply to each section.
-     This is typically objfile->section_offsets, but in some cases
-     it's different.  See, e.g., elfstab_offset_sections.  */
-
-  struct section_offsets *section_offsets;
-
   /* Range of text addresses covered by this file; texthigh is the
      beginning of the next section.  Do not use if PSYMTABS_ADDRMAP_SUPPORTED
      is set.  */
@@ -132,7 +124,7 @@ struct partial_symtab
      In DWARF terms, a shared psymtab is a DW_TAG_partial_unit; but
      of course using a name based on that would be too confusing, so
      "shared" was chosen instead.
-     
+
      Only a single user is needed because, when expanding a shared
      psymtab, we only need to expand its "canonical" non-shared user.
      The choice of which one should be canonical is left to the
@@ -192,10 +184,10 @@ struct partial_symtab
 
   ENUM_BITFIELD (psymtab_search_status) searched_flag : 2;
 
-  /* Pointer to symtab eventually allocated for this source file, 0 if
+  /* Pointer to compunit eventually allocated for this source file, 0 if
      !readin or if we haven't looked for the symtab after it was readin.  */
 
-  struct symtab *symtab;
+  struct compunit_symtab *compunit_symtab;
 
   /* Pointer to function which will read in the symtab corresponding to
      this psymtab.  */
@@ -210,32 +202,64 @@ struct partial_symtab
   void *read_symtab_private;
 };
 
-extern void sort_pst_symbols (struct objfile *, struct partial_symtab *);
-
 /* Add any kind of symbol to a psymbol_allocation_list.  */
 
 extern void add_psymbol_to_list (const char *, int,
                                 int, domain_enum,
                                 enum address_class,
                                 struct psymbol_allocation_list *,
-                                long, CORE_ADDR,
+                                CORE_ADDR,
                                 enum language, struct objfile *);
 
 extern void init_psymbol_list (struct objfile *, int);
 
 extern struct partial_symtab *start_psymtab_common (struct objfile *,
-                                                   struct section_offsets *,
                                                    const char *, CORE_ADDR,
                                                    struct partial_symbol **,
                                                    struct partial_symbol **);
 
+extern void end_psymtab_common (struct objfile *, struct partial_symtab *);
+
 extern struct partial_symtab *allocate_psymtab (const char *,
                                                struct objfile *)
   ATTRIBUTE_NONNULL (1);
 
 extern void discard_psymtab (struct objfile *, struct partial_symtab *);
 
-extern struct cleanup *make_cleanup_discard_psymtabs (struct objfile *);
+/* Used when recording partial symbol tables.  On destruction,
+   discards any partial symbol tables that have been built.  However,
+   the tables can be kept by calling the "keep" method.  */
+class psymtab_discarder
+{
+ public:
+
+  psymtab_discarder (struct objfile *objfile)
+    : m_objfile (objfile),
+      m_psymtab (objfile->psymtabs)
+  {
+  }
+
+  ~psymtab_discarder ()
+  {
+    if (m_objfile != NULL)
+      while (m_objfile->psymtabs != m_psymtab)
+       discard_psymtab (m_objfile, m_objfile->psymtabs);
+  }
+
+  /* Keep any partial symbol tables that were built.  */
+  void keep ()
+  {
+    m_objfile = NULL;
+  }
+
+ private:
+
+  /* The objfile.  If NULL this serves as a sentinel to indicate that
+     the psymtabs should be kept.  */
+  struct objfile *m_objfile;
+  /* How far back to free.  */
+  struct partial_symtab *m_psymtab;
+};
 
 /* Traverse all psymtabs in one objfile.  */
 
This page took 0.025783 seconds and 4 git commands to generate.