aboutsummaryrefslogtreecommitdiff
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
commit5895093f4a8767f8ad41cdc06f3f24b41cacf748 (patch)
tree4e81e7524272acc1a69d5a7d9f1576d8042874e8
parentb3b3227982613ac926b58b84e16867624ae0ed04 (diff)
downloadgdb-5895093f4a8767f8ad41cdc06f3f24b41cacf748.zip
gdb-5895093f4a8767f8ad41cdc06f3f24b41cacf748.tar.gz
gdb-5895093f4a8767f8ad41cdc06f3f24b41cacf748.tar.bz2
Change dwarf2_per_objfile::quick_file_names_table to htab_up
This changes dwarf2_per_objfile::quick_file_names_table to be an htab_up. This just removes a bit of manual management. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (~dwarf2_per_objfile): Update. (create_quick_file_names_table): Return htab_up. (dw2_get_file_names_reader, dw2_forget_cached_source_info): Update. * dwarf2/read.h (struct dwarf2_per_objfile) <quick_file_names_table>: Now htab_up. Change-Id: I4ff2fce8b8af27f4bfe01a11b97a889edfd23151
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2/read.c15
-rw-r--r--gdb/dwarf2/read.h2
3 files changed, 16 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2dc3a7c..5f51d56 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2020-02-08 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (~dwarf2_per_objfile): Update.
+ (create_quick_file_names_table): Return htab_up.
+ (dw2_get_file_names_reader, dw2_forget_cached_source_info):
+ Update.
+ * dwarf2/read.h (struct dwarf2_per_objfile)
+ <quick_file_names_table>: Now htab_up.
+
+2020-02-08 Tom Tromey <tom@tromey.com>
+
* dwarf2/abbrev.c (abbrev_table::read): Simplify.
2020-02-08 Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 345535a..6e893ba 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2011,9 +2011,6 @@ dwarf2_per_objfile::~dwarf2_per_objfile ()
/* Cached DIE trees use xmalloc and the comp_unit_obstack. */
free_cached_comp_units ();
- if (quick_file_names_table)
- htab_delete (quick_file_names_table);
-
for (dwarf2_per_cu_data *per_cu : all_comp_units)
per_cu->imported_symtabs_free ();
@@ -2524,12 +2521,12 @@ delete_file_name_entry (void *e)
/* Create a quick_file_names hash table. */
-static htab_t
+static htab_up
create_quick_file_names_table (unsigned int nr_initial_entries)
{
- return htab_create_alloc (nr_initial_entries,
- hash_file_name_entry, eq_file_name_entry,
- delete_file_name_entry, xcalloc, xfree);
+ return htab_up (htab_create_alloc (nr_initial_entries,
+ hash_file_name_entry, eq_file_name_entry,
+ delete_file_name_entry, xcalloc, xfree));
}
/* Read in PER_CU->CU. This function is unrelated to symtabs, symtab would
@@ -3365,7 +3362,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
If we have we're done. */
find_entry.hash.dwo_unit = cu->dwo_unit;
find_entry.hash.line_sect_off = line_offset;
- slot = htab_find_slot (dwarf2_per_objfile->quick_file_names_table,
+ slot = htab_find_slot (dwarf2_per_objfile->quick_file_names_table.get (),
&find_entry, INSERT);
if (*slot != NULL)
{
@@ -3489,7 +3486,7 @@ dw2_forget_cached_source_info (struct objfile *objfile)
struct dwarf2_per_objfile *dwarf2_per_objfile
= get_dwarf2_per_objfile (objfile);
- htab_traverse_noresize (dwarf2_per_objfile->quick_file_names_table,
+ htab_traverse_noresize (dwarf2_per_objfile->quick_file_names_table.get (),
dw2_free_cached_file_names, NULL);
}
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index c177747..138a929 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -205,7 +205,7 @@ public:
sorted all the TUs into "type unit groups", grouped by their
DW_AT_stmt_list value. Therefore the only sharing done here is with a
CU and its associated TU group if there is one. */
- htab_t quick_file_names_table {};
+ htab_up quick_file_names_table;
/* Set during partial symbol reading, to prevent queueing of full
symbols. */