Add end_psymtab_common, have all debug info readers call it.
authorDoug Evans <xdje42@gmail.com>
Sat, 15 Aug 2015 23:46:20 +0000 (16:46 -0700)
committerDoug Evans <xdje42@gmail.com>
Sat, 15 Aug 2015 23:46:20 +0000 (16:46 -0700)
gdb/ChangeLog:

* dbxread.c (dbx_end_psymtab): Renamed from end_psymtab.  All callers
updated.  Call end_psymtab_common.
* dwarf2read.c (process_psymtab_comp_unit_reader): Call
end_psymtab_common.
(build_type_psymtabs_reader): Ditto.
* psympriv.h (sort_pst_symbols): Delete.
(end_psymtab_common): Declare.
* psymtab.c (sort_pst_symbols): Make static.
(end_psymtab_common): New function.
* xcoffread.c (xcoff_end_psymtab): Call end_psymtab_common.

gdb/ChangeLog
gdb/dbxread.c
gdb/dwarf2read.c
gdb/mdebugread.c
gdb/psympriv.h
gdb/psymtab.c
gdb/stabsread.h
gdb/symtab.h
gdb/xcoffread.c

index 759f4ce094033c1337269712bad08a791cd79616..8f6ced97452bba607b9dd89324d17094e9a1be27 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-15  Doug Evans  <xdje42@gmail.com>
+
+       * dbxread.c (dbx_end_psymtab): Renamed from end_psymtab.  All callers
+       updated.  Call end_psymtab_common.
+       * dwarf2read.c (process_psymtab_comp_unit_reader): Call
+       end_psymtab_common.
+       (build_type_psymtabs_reader): Ditto.
+       * psympriv.h (sort_pst_symbols): Delete.
+       (end_psymtab_common): Declare.
+       * psymtab.c (sort_pst_symbols): Make static.
+       (end_psymtab_common): New function.
+       * xcoffread.c (xcoff_end_psymtab): Call end_psymtab_common.
+
 2015-08-15  Doug Evans  <xdje42@gmail.com>
 
        * defs.h (LANGUAGE_BITS): Define.
index 6098b357c4a552ac14383c8895bf79f8822618e7..dc2eda29ae5bf14d5cb9c091b72db263f2aa1603 100644 (file)
@@ -158,7 +158,7 @@ static int block_address_function_relative = 0;
 static CORE_ADDR lowest_text_address;
 
 /* Non-zero if there is any line number info in the objfile.  Prevents
-   end_psymtab from discarding an otherwise empty psymtab.  */
+   dbx_end_psymtab from discarding an otherwise empty psymtab.  */
 
 static int has_line_numbers;
 
@@ -1358,12 +1358,12 @@ read_dbx_symtab (struct objfile *objfile)
                     which are not the address.  */
                  && nlist.n_value >= pst->textlow)
                {
-                 end_psymtab (objfile, pst, psymtab_include_list,
-                              includes_used, symnum * symbol_size,
-                              nlist.n_value > pst->texthigh
-                              ? nlist.n_value : pst->texthigh,
-                              dependency_list, dependencies_used,
-                              textlow_not_set);
+                 dbx_end_psymtab (objfile, pst, psymtab_include_list,
+                                  includes_used, symnum * symbol_size,
+                                  nlist.n_value > pst->texthigh
+                                  ? nlist.n_value : pst->texthigh,
+                                  dependency_list, dependencies_used,
+                                  textlow_not_set);
                  pst = (struct partial_symtab *) 0;
                  includes_used = 0;
                  dependencies_used = 0;
@@ -1454,7 +1454,7 @@ read_dbx_symtab (struct objfile *objfile)
            prev_textlow_not_set = textlow_not_set;
 
            /* A zero value is probably an indication for the SunPRO 3.0
-              compiler.  end_psymtab explicitly tests for zero, so
+              compiler.  dbx_end_psymtab explicitly tests for zero, so
               don't relocate it.  */
 
            if (nlist.n_value == 0
@@ -1474,11 +1474,12 @@ read_dbx_symtab (struct objfile *objfile)
 
                if (pst)
                  {
-                   end_psymtab (objfile, pst, psymtab_include_list,
-                                includes_used, symnum * symbol_size,
-                                valu > pst->texthigh ? valu : pst->texthigh,
-                                dependency_list, dependencies_used,
-                                prev_textlow_not_set);
+                   dbx_end_psymtab (objfile, pst, psymtab_include_list,
+                                    includes_used, symnum * symbol_size,
+                                    valu > pst->texthigh
+                                    ? valu : pst->texthigh,
+                                    dependency_list, dependencies_used,
+                                    prev_textlow_not_set);
                    pst = (struct partial_symtab *) 0;
                    includes_used = 0;
                    dependencies_used = 0;
@@ -2080,15 +2081,16 @@ read_dbx_symtab (struct objfile *objfile)
 
        case N_ENDM:
          /* Solaris 2 end of module, finish current partial symbol table.
-            end_psymtab will set pst->texthigh to the proper value, which
+            dbx_end_psymtab will set pst->texthigh to the proper value, which
             is necessary if a module compiled without debugging info
             follows this module.  */
          if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
            {
-             end_psymtab (objfile, pst, psymtab_include_list, includes_used,
-                          symnum * symbol_size,
-                          (CORE_ADDR) 0, dependency_list,
-                          dependencies_used, textlow_not_set);
+             dbx_end_psymtab (objfile, pst,
+                              psymtab_include_list, includes_used,
+                              symnum * symbol_size,
+                              (CORE_ADDR) 0, dependency_list,
+                              dependencies_used, textlow_not_set);
              pst = (struct partial_symtab *) 0;
              includes_used = 0;
              dependencies_used = 0;
@@ -2150,10 +2152,10 @@ read_dbx_symtab (struct objfile *objfile)
         : lowest_text_address)
        + text_size;
 
-      end_psymtab (objfile, pst, psymtab_include_list, includes_used,
-                  symnum * symbol_size,
-                  text_end > pst->texthigh ? text_end : pst->texthigh,
-                  dependency_list, dependencies_used, textlow_not_set);
+      dbx_end_psymtab (objfile, pst, psymtab_include_list, includes_used,
+                      symnum * symbol_size,
+                      text_end > pst->texthigh ? text_end : pst->texthigh,
+                      dependency_list, dependencies_used, textlow_not_set);
     }
 
   do_cleanups (back_to);
@@ -2196,11 +2198,12 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
    FIXME:  List variables and peculiarities of same.  */
 
 struct partial_symtab *
-end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
-            const char **include_list, int num_includes,
-            int capping_symbol_offset, CORE_ADDR capping_text,
-            struct partial_symtab **dependency_list, int number_dependencies,
-            int textlow_not_set)
+dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+                const char **include_list, int num_includes,
+                int capping_symbol_offset, CORE_ADDR capping_text,
+                struct partial_symtab **dependency_list,
+                int number_dependencies,
+                int textlow_not_set)
 {
   int i;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -2287,12 +2290,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
 
   /* End of kludge for patching Solaris textlow and texthigh.  */
 
-  pst->n_global_syms =
-    objfile->global_psymbols.next - (objfile->global_psymbols.list
-                                    + pst->globals_offset);
-  pst->n_static_syms =
-    objfile->static_psymbols.next - (objfile->static_psymbols.list
-                                    + pst->statics_offset);
+  end_psymtab_common (objfile, pst);
 
   pst->number_of_dependencies = number_dependencies;
   if (number_dependencies)
@@ -2336,8 +2334,6 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->read_symtab = pst->read_symtab;
     }
 
-  sort_pst_symbols (objfile, pst);
-
   if (num_includes == 0
       && number_dependencies == 0
       && pst->n_global_syms == 0
index 7ae50f7a5daa60f9def0ca65bc7c15a2b6a68762..7a7fb93ebfbe3cbdbbc384bb4d61e9c49f2b59e0 100644 (file)
@@ -6019,11 +6019,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   pst->textlow = gdbarch_adjust_dwarf2_addr (gdbarch, best_lowpc + baseaddr);
   pst->texthigh = gdbarch_adjust_dwarf2_addr (gdbarch, best_highpc + baseaddr);
 
-  pst->n_global_syms = objfile->global_psymbols.next -
-    (objfile->global_psymbols.list + pst->globals_offset);
-  pst->n_static_syms = objfile->static_psymbols.next -
-    (objfile->static_psymbols.list + pst->statics_offset);
-  sort_pst_symbols (objfile, pst);
+  end_psymtab_common (objfile, pst);
 
   if (!VEC_empty (dwarf2_per_cu_ptr, cu->per_cu->imported_symtabs))
     {
@@ -6135,11 +6131,7 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader,
   highpc = (CORE_ADDR) 0;
   scan_partial_symbols (first_die, &lowpc, &highpc, 0, cu);
 
-  pst->n_global_syms = objfile->global_psymbols.next -
-    (objfile->global_psymbols.list + pst->globals_offset);
-  pst->n_static_syms = objfile->static_psymbols.next -
-    (objfile->static_psymbols.list + pst->statics_offset);
-  sort_pst_symbols (objfile, pst);
+  end_psymtab_common (objfile, pst);
 }
 
 /* Struct used to sort TUs by their abbreviation table offset.  */
index 3a81615f34737470a2b381608bb9f79ee6c3730e..5344d2f887caf4a36caf8ca9394df4f59c4acdc4 100644 (file)
@@ -2936,7 +2936,7 @@ parse_partial_symbols (struct objfile *objfile)
                      prev_textlow_not_set = textlow_not_set;
 
                      /* A zero value is probably an indication for the
-                        SunPRO 3.0 compiler.  end_psymtab explicitly tests
+                        SunPRO 3.0 compiler.  dbx_end_psymtab explicitly tests
                         for zero, so don't relocate it.  */
 
                      if (sh.value == 0
@@ -3347,7 +3347,7 @@ parse_partial_symbols (struct objfile *objfile)
 
                  case N_ENDM:
                    /* Solaris 2 end of module, finish current partial
-                      symbol table.  END_PSYMTAB will set
+                      symbol table.  dbx_end_psymtab will set
                       pst->texthigh to the proper value, which is
                       necessary if a module compiled without
                       debugging info follows this module.  */
@@ -3731,12 +3731,14 @@ parse_partial_symbols (struct objfile *objfile)
            }
        }
 
-      /* Link pst to FDR.  end_psymtab returns NULL if the psymtab was
+      /* Link pst to FDR.  dbx_end_psymtab returns NULL if the psymtab was
          empty and put on the free list.  */
-      fdr_to_pst[f_idx].pst = end_psymtab (objfile, save_pst,
-                                       psymtab_include_list, includes_used,
-                                          -1, save_pst->texthigh,
-                      dependency_list, dependencies_used, textlow_not_set);
+      fdr_to_pst[f_idx].pst
+       = dbx_end_psymtab (objfile, save_pst,
+                          psymtab_include_list, includes_used,
+                          -1, save_pst->texthigh,
+                          dependency_list, dependencies_used,
+                          textlow_not_set);
       includes_used = 0;
       dependencies_used = 0;
 
index 3efb01fe48a950565c54edd1209d85c42ae666f3..2cf319099a7e947107b2848b7168976e10534c44 100644 (file)
@@ -201,8 +201,6 @@ 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,
@@ -219,6 +217,8 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *,
                                                    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);
index 9124b55c2d355f016f90a344e5f3071a819a2c1a..5d0aa1c61d580b95babee960161e8c70ea8898d4 100644 (file)
@@ -1496,7 +1496,7 @@ compare_psymbols (const void *s1p, const void *s2p)
                            SYMBOL_SEARCH_NAME (*s2));
 }
 
-void
+static void
 sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst)
 {
   /* Sort the global list; don't sort the static list.  */
@@ -1527,6 +1527,21 @@ start_psymtab_common (struct objfile *objfile,
   return psymtab;
 }
 
+/* Perform "finishing up" operations of a partial symtab.  */
+
+void
+end_psymtab_common (struct objfile *objfile, struct partial_symtab *pst)
+{
+  pst->n_global_syms
+    = objfile->global_psymbols.next - (objfile->global_psymbols.list
+                                      + pst->globals_offset);
+  pst->n_static_syms
+    = objfile->static_psymbols.next - (objfile->static_psymbols.list
+                                      + pst->statics_offset);
+
+  sort_pst_symbols (objfile, pst);
+}
+
 /* 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
index dbf5e1de864645d0f3f0a463bc2c486424fd8f49..65cccd20add155c26e7d2eb7088f17565a458774 100644 (file)
@@ -160,16 +160,12 @@ struct stab_section_list
 /* Functions exported by dbxread.c.  These are not in stabsread.c because
    they are only used by some stabs readers.  */
 
-extern struct partial_symtab *end_psymtab (struct objfile *objfile,
-                                          struct partial_symtab *pst,
-                                          const char **include_list,
-                                          int num_includes,
-                                          int capping_symbol_offset,
-                                          CORE_ADDR capping_text,
-                                          struct partial_symtab
-                                          **dependency_list,
-                                          int number_dependencies,
-                                          int textlow_not_set);
+extern struct partial_symtab *dbx_end_psymtab
+  (struct objfile *objfile, struct partial_symtab *pst,
+   const char **include_list, int num_includes,
+   int capping_symbol_offset, CORE_ADDR capping_text,
+   struct partial_symtab **dependency_list, int number_dependencies,
+   int textlow_not_set);
 
 extern void process_one_symbol (int, int, CORE_ADDR, char *,
                                const struct section_offsets *,
index 0109b9678d771ba5fa77c03b71faa5bb9b440ac5..e67151f739d6a58a675a9d345e772e470175c381 100644 (file)
@@ -340,7 +340,7 @@ struct minimal_symbol
 
   struct general_symbol_info mginfo;
 
-  /* Size of this symbol.  end_psymtab in dbxread.c uses this
+  /* Size of this symbol.  dbx_end_psymtab in dbxread.c uses this
      information to calculate the end of the partial symtab based on the
      address of the last symbol plus the size of the last symbol.  */
 
index b5b2a1d27d325462b3c11268be0fea7c8e0e4d57..5940ec95fa37f59c3727b53a3f619f5322b31a59 100644 (file)
@@ -2057,10 +2057,8 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
   ((struct symloc *) pst->read_symtab_private)->lineno_off =
     first_fun_line_offset;
   first_fun_line_offset = 0;
-  pst->n_global_syms = objfile->global_psymbols.next
-    - (objfile->global_psymbols.list + pst->globals_offset);
-  pst->n_static_syms = objfile->static_psymbols.next
-    - (objfile->static_psymbols.list + pst->statics_offset);
+
+  end_psymtab_common (objfile, pst);
 
   pst->number_of_dependencies = number_dependencies;
   if (number_dependencies)
@@ -2104,8 +2102,6 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->read_symtab = pst->read_symtab;
     }
 
-  sort_pst_symbols (objfile, pst);
-
   if (num_includes == 0
       && number_dependencies == 0
       && pst->n_global_syms == 0
This page took 0.064553 seconds and 4 git commands to generate.