aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-11-01 09:51:13 -0700
committerTom Tromey <tom@tromey.com>2020-11-01 09:51:15 -0700
commitae7754b256f1f230baec364d90561c3ca34f7e64 (patch)
treece37e71c6106a8e4937f096cd688e1cd48565ab4 /gdb
parent0684bb51b5207aed1d76098ebaca6243f9c168e7 (diff)
downloadgdb-ae7754b256f1f230baec364d90561c3ca34f7e64.zip
gdb-ae7754b256f1f230baec364d90561c3ca34f7e64.tar.gz
gdb-ae7754b256f1f230baec364d90561c3ca34f7e64.tar.bz2
Change end_psymtab_common to a method
This changes end_psymtab_common to be a method on partial_symtab. This seems a little cleaner to me. gdb/ChangeLog 2020-11-01 Tom Tromey <tom@tromey.com> * dbxread.c (dbx_end_psymtab): Update. * dwarf2/read.c (process_psymtab_comp_unit_reader) (build_type_psymtabs_reader): Update. * xcoffread.c (xcoff_end_psymtab): Update. * ctfread.c (scan_partial_symbols): Update. * psymtab.c (sort_pst_symbols): Remove. (partial_symtab::end): Rename from end_psymtab_common. Inline sort_pst_symbols. * psympriv.h (struct partial_symtab) <end>: New method. (end_psymtab_common): Don't declare.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/ctfread.c2
-rw-r--r--gdb/dbxread.c2
-rw-r--r--gdb/dwarf2/read.c4
-rw-r--r--gdb/psympriv.h6
-rw-r--r--gdb/psymtab.c28
-rw-r--r--gdb/xcoffread.c2
7 files changed, 33 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f34932d..8457c75 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
2020-11-01 Tom Tromey <tom@tromey.com>
+ * dbxread.c (dbx_end_psymtab): Update.
+ * dwarf2/read.c (process_psymtab_comp_unit_reader)
+ (build_type_psymtabs_reader): Update.
+ * xcoffread.c (xcoff_end_psymtab): Update.
+ * ctfread.c (scan_partial_symbols): Update.
+ * psymtab.c (sort_pst_symbols): Remove.
+ (partial_symtab::end): Rename from end_psymtab_common. Inline
+ sort_pst_symbols.
+ * psympriv.h (struct partial_symtab) <end>: New method.
+ (end_psymtab_common): Don't declare.
+
+2020-11-01 Tom Tromey <tom@tromey.com>
+
* symmisc.c (count_psyms): New function.
(print_objfile_statistics): Use it.
* psymtab.c (append_psymbol_to_list): Remove.
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index b8d8434..52eef80 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1464,7 +1464,7 @@ scan_partial_symbols (ctf_file_t *cfp, struct objfile *of)
0, language_c, of);
}
- end_psymtab_common (pst);
+ pst->end ();
}
/* Read CTF debugging information from a BFD section. This is
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index f9ee007..0d8c59e 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2004,7 +2004,7 @@ dbx_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
/* End of kludge for patching Solaris textlow and texthigh. */
- end_psymtab_common (pst);
+ pst->end ();
pst->number_of_dependencies = number_dependencies;
if (number_dependencies)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index d3d88b1..19131da 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7634,7 +7634,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
best_highpc + baseaddr)
- baseaddr);
- end_psymtab_common (pst);
+ pst->end ();
if (!cu->per_cu->imported_symtabs_empty ())
{
@@ -7760,7 +7760,7 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader,
highpc = (CORE_ADDR) 0;
scan_partial_symbols (first_die, &lowpc, &highpc, 0, cu);
- end_psymtab_common (pst);
+ pst->end ();
}
/* Struct used to sort TUs by their abbreviation table offset. */
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 53dfb1b..ac2c611 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -248,6 +248,10 @@ struct partial_symtab
struct objfile *objfile);
+ /* Indicate that this partial symtab is complete. */
+
+ void end ();
+
/* Chain of all existing partial symtabs. */
struct partial_symtab *next = nullptr;
@@ -436,8 +440,6 @@ struct legacy_psymtab : public standard_psymtab
void *read_symtab_private = nullptr;
};
-extern void end_psymtab_common (struct partial_symtab *);
-
/* 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. */
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index dc802a6..ef190d5 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1430,19 +1430,6 @@ const struct quick_symbol_functions psym_functions =
-static void
-sort_pst_symbols (struct partial_symtab *pst)
-{
- /* Sort the global list; don't sort the static list. */
- std::sort (pst->global_psymbols.begin (),
- pst->global_psymbols.end (),
- [] (partial_symbol *s1, partial_symbol *s2)
- {
- return strcmp_iw_ordered (s1->ginfo.search_name (),
- s2->ginfo.search_name ()) < 0;
- });
-}
-
/* Partially fill a partial symtab. It will be completely filled at
the end of the symbol list. */
@@ -1458,12 +1445,19 @@ partial_symtab::partial_symtab (const char *filename,
/* Perform "finishing up" operations of a partial symtab. */
void
-end_psymtab_common (struct partial_symtab *pst)
+partial_symtab::end ()
{
- pst->global_psymbols.shrink_to_fit ();
- pst->static_psymbols.shrink_to_fit ();
+ global_psymbols.shrink_to_fit ();
+ static_psymbols.shrink_to_fit ();
- sort_pst_symbols (pst);
+ /* Sort the global list; don't sort the static list. */
+ std::sort (global_psymbols.begin (),
+ global_psymbols.end (),
+ [] (partial_symbol *s1, partial_symbol *s2)
+ {
+ return strcmp_iw_ordered (s1->ginfo.search_name (),
+ s2->ginfo.search_name ()) < 0;
+ });
}
/* See psymtab.h. */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 3383032..2c837cf 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2000,7 +2000,7 @@ xcoff_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
first_fun_line_offset;
first_fun_line_offset = 0;
- end_psymtab_common (pst);
+ pst->end ();
pst->number_of_dependencies = number_dependencies;
if (number_dependencies)