aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/abbrev.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-08 13:40:54 -0700
committerTom Tromey <tom@tromey.com>2020-02-08 13:43:24 -0700
commit86de1d91ac93e48f77ea9fe61edfdba8ac24aa02 (patch)
tree22574dfcc0506ec988d7577cd7ee30fc2706a916 /gdb/dwarf2/abbrev.h
parent0335378b4cd2fc8246b2eb7cfe2b7e4cf757a377 (diff)
downloadgdb-86de1d91ac93e48f77ea9fe61edfdba8ac24aa02.zip
gdb-86de1d91ac93e48f77ea9fe61edfdba8ac24aa02.tar.gz
gdb-86de1d91ac93e48f77ea9fe61edfdba8ac24aa02.tar.bz2
Minor cleanups in abbrev_table
This cleans up the DWARF abbrev_table API a bit, primarily by making various methods and members private. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_cutu_die_from_dwo): Update. (cutu_reader): Update. (build_type_psymtabs_1): Update. * dwarf2/abbrev.c (abbrev_table::read): Rename. (abbrev_table::alloc_abbrev): Update. * dwarf2/abbrev.h (abbrev_table_up): Move earlier. (abbrev_table::read): New static method, renamed from abbrev_table_read_table. (abbrev_table::alloc_abbrev) (abbrev_table::add_abbrev): Now private. (abbrev_table::abbrev_table): Now private. (abbrev_table::m_abbrev_obstack): Now private. Rename. Change-Id: I320dca83b799f672909ae66f73b7aca266adbaf9
Diffstat (limited to 'gdb/dwarf2/abbrev.h')
-rw-r--r--gdb/dwarf2/abbrev.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index df83c09..52103b0 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -50,15 +50,34 @@ struct attr_abbrev
/* Size of abbrev_table.abbrev_hash_table. */
#define ABBREV_HASH_SIZE 121
+struct abbrev_table;
+typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
+
/* Top level data structure to contain an abbreviation table. */
struct abbrev_table
{
+ static abbrev_table_up read (struct objfile *objfile,
+ struct dwarf2_section_info *section,
+ sect_offset sect_off);
+
+ /* Look up an abbrev in the table.
+ Returns NULL if the abbrev is not found. */
+
+ struct abbrev_info *lookup_abbrev (unsigned int abbrev_number);
+
+
+ /* Where the abbrev table came from.
+ This is used as a sanity check when the table is used. */
+ const sect_offset sect_off;
+
+private:
+
explicit abbrev_table (sect_offset off)
: sect_off (off)
{
m_abbrevs =
- XOBNEWVEC (&abbrev_obstack, struct abbrev_info *, ABBREV_HASH_SIZE);
+ XOBNEWVEC (&m_abbrev_obstack, struct abbrev_info *, ABBREV_HASH_SIZE);
memset (m_abbrevs, 0, ABBREV_HASH_SIZE * sizeof (struct abbrev_info *));
}
@@ -71,33 +90,14 @@ struct abbrev_table
/* Add an abbreviation to the table. */
void add_abbrev (unsigned int abbrev_number, struct abbrev_info *abbrev);
- /* Look up an abbrev in the table.
- Returns NULL if the abbrev is not found. */
-
- struct abbrev_info *lookup_abbrev (unsigned int abbrev_number);
-
-
- /* Where the abbrev table came from.
- This is used as a sanity check when the table is used. */
- const sect_offset sect_off;
-
- /* Storage for the abbrev table. */
- auto_obstack abbrev_obstack;
-
-private:
-
/* Hash table of abbrevs.
This is an array of size ABBREV_HASH_SIZE allocated in abbrev_obstack.
It could be statically allocated, but the previous code didn't so we
don't either. */
struct abbrev_info **m_abbrevs;
-};
-typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
-
-extern abbrev_table_up abbrev_table_read_table
- (struct objfile *objfile,
- struct dwarf2_section_info *section,
- sect_offset sect_off);
+ /* Storage for the abbrev table. */
+ auto_obstack m_abbrev_obstack;
+};
#endif /* GDB_DWARF2_ABBREV_H */