aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
commiteaa5fa8b291fed6f97c315680953ca94d4eafb72 (patch)
tree988c21327e662e1da916c2ebd8e9463b8c2ad438 /gdb
parentb0b6a9878a472438a6fe2e93be819546efc5033a (diff)
downloadgdb-eaa5fa8b291fed6f97c315680953ca94d4eafb72.zip
gdb-eaa5fa8b291fed6f97c315680953ca94d4eafb72.tar.gz
gdb-eaa5fa8b291fed6f97c315680953ca94d4eafb72.tar.bz2
Change dwarf2_per_objfile::type_unit_groups to htab_up
This changes dwarf2_per_objfile::type_unit_groups to be an htab_up, again allowing us to move the memory used by the hash table from the objfile obstack to the heap. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (allocate_type_unit_groups_table): Return htab_up. Don't allocate on obstack. (get_type_unit_group, dwarf2_build_psymtabs_hard): Update. * dwarf2/read.h (struct dwarf2_per_objfile) <type_unit_groups>: Change type to htab_up. Change-Id: Ia045df0ff3ec30aac813da5a9a2314a607ef7ec8
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/dwarf2/read.c17
-rw-r--r--gdb/dwarf2/read.h2
3 files changed, 16 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 50aecc7..7e603f0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2020-02-08 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (allocate_type_unit_groups_table): Return
+ htab_up. Don't allocate on obstack.
+ (get_type_unit_group, dwarf2_build_psymtabs_hard): Update.
+ * dwarf2/read.h (struct dwarf2_per_objfile) <type_unit_groups>:
+ Change type to htab_up.
+
+2020-02-08 Tom Tromey <tom@tromey.com>
+
* dwarf2/read.h (struct dwarf2_per_objfile) <signatured_types>:
Change type to htab_up.
* dwarf2/read.c (create_signatured_type_table_from_index)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index d47a90b..f6501c6 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7520,16 +7520,13 @@ eq_type_unit_group (const void *item_lhs, const void *item_rhs)
/* Allocate a hash table for type unit groups. */
-static htab_t
+static htab_up
allocate_type_unit_groups_table (struct objfile *objfile)
{
- return htab_create_alloc_ex (3,
- hash_type_unit_group,
- eq_type_unit_group,
- NULL,
- &objfile->objfile_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ return htab_up (htab_create_alloc (3,
+ hash_type_unit_group,
+ eq_type_unit_group,
+ NULL, xcalloc, xfree));
}
/* Type units that don't have DW_AT_stmt_list are grouped into their own
@@ -7625,7 +7622,7 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
type_unit_group_for_lookup.hash.dwo_unit = cu->dwo_unit;
type_unit_group_for_lookup.hash.line_sect_off = (sect_offset) line_offset;
- slot = htab_find_slot (dwarf2_per_objfile->type_unit_groups,
+ slot = htab_find_slot (dwarf2_per_objfile->type_unit_groups.get (),
&type_unit_group_for_lookup, INSERT);
if (*slot != NULL)
{
@@ -8193,7 +8190,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile)
/* Now that all TUs have been processed we can fill in the dependencies. */
if (dwarf2_per_objfile->type_unit_groups != NULL)
{
- htab_traverse_noresize (dwarf2_per_objfile->type_unit_groups,
+ htab_traverse_noresize (dwarf2_per_objfile->type_unit_groups.get (),
build_type_psymtab_dependencies, dwarf2_per_objfile);
}
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index ac87258..9e08cc1 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -153,7 +153,7 @@ public:
/* Table of struct type_unit_group objects.
The hash key is the DW_AT_stmt_list value. */
- htab_t type_unit_groups {};
+ htab_up type_unit_groups;
/* A table mapping .debug_types signatures to its signatured_type entry.
This is NULL if the .debug_types section hasn't been read in yet. */