Introduce partial_symtab::read_symtab method
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index f865fa484826a0a204f4f2b427c7447be1e5e830..8bde26534e300c52c8f5ccd97b7f5667b49c9ffa 100644 (file)
@@ -1480,7 +1480,7 @@ static const char *get_section_file_name (const struct dwarf2_section_info *);
 static void dwarf2_find_base_address (struct die_info *die,
                                      struct dwarf2_cu *cu);
 
-static struct partial_symtab *create_partial_symtab
+static dwarf2_psymtab *create_partial_symtab
   (struct dwarf2_per_cu_data *per_cu, const char *name);
 
 static void build_type_psymtabs_reader (const struct die_reader_specs *reader,
@@ -1513,10 +1513,7 @@ static void add_partial_subprogram (struct partial_die_info *pdi,
                                    CORE_ADDR *lowpc, CORE_ADDR *highpc,
                                    int need_pc, struct dwarf2_cu *cu);
 
-static void dwarf2_read_symtab (struct partial_symtab *,
-                               struct objfile *);
-
-static void psymtab_to_symtab_1 (struct partial_symtab *);
+static void psymtab_to_symtab_1 (dwarf2_psymtab *);
 
 static abbrev_table_up abbrev_table_read_table
   (struct dwarf2_per_objfile *dwarf2_per_objfile, struct dwarf2_section_info *,
@@ -1644,7 +1641,7 @@ static line_header_up dwarf_decode_line_header (sect_offset sect_off,
                                                struct dwarf2_cu *cu);
 
 static void dwarf_decode_lines (struct line_header *, const char *,
-                               struct dwarf2_cu *, struct partial_symtab *,
+                               struct dwarf2_cu *, dwarf2_psymtab *,
                                CORE_ADDR, int decode_mapping);
 
 static void dwarf2_start_subfile (struct dwarf2_cu *, const char *,
@@ -1703,7 +1700,7 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
 static void read_variable (struct die_info *die, struct dwarf2_cu *cu);
 
 static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
-                              struct dwarf2_cu *, struct partial_symtab *);
+                              struct dwarf2_cu *, dwarf2_psymtab *);
 
 /* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
    values.  Keep the items ordered with increasing constraints compliance.  */
@@ -1726,7 +1723,7 @@ enum pc_bounds_kind
 static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
                                                 CORE_ADDR *, CORE_ADDR *,
                                                 struct dwarf2_cu *,
-                                                struct partial_symtab *);
+                                                dwarf2_psymtab *);
 
 static void get_scope_pc_bounds (struct die_info *,
                                 CORE_ADDR *, CORE_ADDR *,
@@ -6692,10 +6689,10 @@ read_abbrev_offset (struct dwarf2_per_objfile *dwarf2_per_objfile,
    partial symtab as being an include of PST.  */
 
 static void
-dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
+dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst,
                                struct objfile *objfile)
 {
-  struct partial_symtab *subpst = new partial_symtab (name, objfile);
+  dwarf2_psymtab *subpst = new dwarf2_psymtab (name, objfile);
 
   if (!IS_ABSOLUTE_PATH (subpst->filename))
     {
@@ -6707,12 +6704,10 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
   subpst->dependencies[0] = pst;
   subpst->number_of_dependencies = 1;
 
-  subpst->read_symtab = pst->read_symtab;
-
   /* No private part is necessary for include psymtabs.  This property
      can be used to differentiate between such include psymtabs and
      the regular ones.  */
-  subpst->read_symtab_private = NULL;
+  subpst->per_cu_data = nullptr;
 }
 
 /* Read the Line Number Program data and extract the list of files
@@ -6722,7 +6717,7 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
 static void
 dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
                               struct die_info *die,
-                              struct partial_symtab *pst)
+                              dwarf2_psymtab *pst)
 {
   line_header_up lh;
   struct attribute *attr;
@@ -7934,7 +7929,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
   else
     {
       unsigned int line_offset = to_underlying (line_offset_struct);
-      struct partial_symtab *pst;
+      dwarf2_psymtab *pst;
       std::string name;
 
       /* Give the symtab a useful name for debug purposes.  */
@@ -8021,19 +8016,18 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
    The caller must fill in the following details:
    dirname, textlow, texthigh.  */
 
-static struct partial_symtab *
+static dwarf2_psymtab *
 create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
 {
   struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
 
-  pst = new partial_symtab (name, objfile, 0);
+  pst = new dwarf2_psymtab (name, objfile, 0);
 
   pst->psymtabs_addrmap_supported = true;
 
   /* This is the glue that links PST into GDB's symbol API.  */
-  pst->read_symtab_private = per_cu;
-  pst->read_symtab = dwarf2_read_symtab;
+  pst->per_cu_data = per_cu;
   per_cu->v.psymtab = pst;
 
   return pst;
@@ -8055,7 +8049,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   struct dwarf2_per_cu_data *per_cu = cu->per_cu;
   CORE_ADDR baseaddr;
   CORE_ADDR best_lowpc = 0, best_highpc = 0;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
   enum pc_bounds_kind cu_bounds_kind;
   const char *filename;
 
@@ -8224,7 +8218,7 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader,
   struct attribute *attr;
   struct partial_die_info *first_die;
   CORE_ADDR lowpc, highpc;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
 
   gdb_assert (per_cu->is_debug_types);
   sig_type = (struct signatured_type *) per_cu;
@@ -8397,7 +8391,7 @@ build_type_psymtab_dependencies (void **slot, void *info)
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct type_unit_group *tu_group = (struct type_unit_group *) *slot;
   struct dwarf2_per_cu_data *per_cu = &tu_group->per_cu;
-  struct partial_symtab *pst = per_cu->v.psymtab;
+  dwarf2_psymtab *pst = per_cu->v.psymtab;
   int len = (tu_group->tus == nullptr) ? 0 : tu_group->tus->size ();
   int i;
 
@@ -8514,7 +8508,7 @@ set_partial_user (struct dwarf2_per_objfile *dwarf2_per_objfile)
 {
   for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
 
       if (pst == NULL)
        continue;
@@ -9494,24 +9488,23 @@ locate_pdi_sibling (const struct die_reader_specs *reader,
 /* Expand this partial symbol table into a full symbol table.  SELF is
    not NULL.  */
 
-static void
-dwarf2_read_symtab (struct partial_symtab *self,
-                   struct objfile *objfile)
+void
+dwarf2_psymtab::read_symtab (struct objfile *objfile)
 {
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = get_dwarf2_per_objfile (objfile);
 
-  if (self->readin)
+  if (readin)
     {
       warning (_("bug: psymtab for %s is already read in."),
-              self->filename);
+              filename);
     }
   else
     {
       if (info_verbose)
        {
          printf_filtered (_("Reading in symbols for %s..."),
-                          self->filename);
+                          filename);
          gdb_flush (gdb_stdout);
        }
 
@@ -9530,7 +9523,7 @@ dwarf2_read_symtab (struct partial_symtab *self,
 
       dwarf2_per_objfile->reading_partial_symbols = 0;
 
-      psymtab_to_symtab_1 (self);
+      psymtab_to_symtab_1 (this);
 
       /* Finish up the debug error message.  */
       if (info_verbose)
@@ -9687,7 +9680,7 @@ process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile)
 /* Read in full symbols for PST, and anything it depends on.  */
 
 static void
-psymtab_to_symtab_1 (struct partial_symtab *pst)
+psymtab_to_symtab_1 (dwarf2_psymtab *pst)
 {
   struct dwarf2_per_cu_data *per_cu;
   int i;
@@ -9711,10 +9704,10 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
             wrap_here ("");     /* Flush output.  */
             gdb_flush (gdb_stdout);
           }
-        psymtab_to_symtab_1 (pst->dependencies[i]);
+        psymtab_to_symtab_1 ((dwarf2_psymtab *) pst->dependencies[i]);
       }
 
-  per_cu = (struct dwarf2_per_cu_data *) pst->read_symtab_private;
+  per_cu = pst->per_cu_data;
 
   if (per_cu == NULL)
     {
@@ -10477,7 +10470,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
     per_cu->v.quick->compunit_symtab = cust;
   else
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
       pst->compunit_symtab = cust;
       pst->readin = true;
     }
@@ -10557,7 +10550,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
     per_cu->v.quick->compunit_symtab = cust;
   else
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
       pst->compunit_symtab = cust;
       pst->readin = true;
     }
@@ -14596,7 +14589,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
 static int
 dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
                    CORE_ADDR *high_return, struct dwarf2_cu *cu,
-                   struct partial_symtab *ranges_pst)
+                   dwarf2_psymtab *ranges_pst)
 {
   struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -14664,7 +14657,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
 static enum pc_bounds_kind
 dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
                      CORE_ADDR *highpc, struct dwarf2_cu *cu,
-                     struct partial_symtab *pst)
+                     dwarf2_psymtab *pst)
 {
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = cu->per_cu->dwarf2_per_objfile;
@@ -20944,7 +20937,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
 
 static const char *
 psymtab_include_file_name (const struct line_header *lh, const file_entry &fe,
-                          const struct partial_symtab *pst,
+                          const dwarf2_psymtab *pst,
                           const char *comp_dir,
                           gdb::unique_xmalloc_ptr<char> *name_holder)
 {
@@ -21645,7 +21638,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 
 static void
 dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
-                   struct dwarf2_cu *cu, struct partial_symtab *pst,
+                   struct dwarf2_cu *cu, dwarf2_psymtab *pst,
                    CORE_ADDR lowpc, int decode_mapping)
 {
   struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
This page took 0.033589 seconds and 4 git commands to generate.