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
commitd15acc425222d23f9224bca4299319179a479801 (patch)
treeed2c4b70aa8b9f17db85c99ec2016aebc9c97213 /gdb
parenteaa5fa8b291fed6f97c315680953ca94d4eafb72 (diff)
downloadgdb-d15acc425222d23f9224bca4299319179a479801.zip
gdb-d15acc425222d23f9224bca4299319179a479801.tar.gz
gdb-d15acc425222d23f9224bca4299319179a479801.tar.bz2
Change dwarf2_per_objfile::line_header_hash to htab_up
This changes dwarf2_per_objfile::line_header_hash to be an htab_up, and changes it to use heap allocation. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (~dwarf2_per_objfile): Don't delete line_header_hash. (handle_DW_AT_stmt_list): Update. Don't allocate on obstack. * dwarf2/read.h (struct dwarf2_per_objfile) <line_header_hash>: Change type to htab_up. Change-Id: Icb148a270838c0f96f38fc4a28b5b77d067927b6
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/dwarf2/read.c18
-rw-r--r--gdb/dwarf2/read.h2
3 files changed, 15 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e603f0..b5c2954 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2020-02-08 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (~dwarf2_per_objfile): Don't delete
+ line_header_hash.
+ (handle_DW_AT_stmt_list): Update. Don't allocate on obstack.
+ * dwarf2/read.h (struct dwarf2_per_objfile) <line_header_hash>:
+ Change type to htab_up.
+
+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.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f6501c6..6c698bd 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2014,9 +2014,6 @@ dwarf2_per_objfile::~dwarf2_per_objfile ()
if (quick_file_names_table)
htab_delete (quick_file_names_table);
- if (line_header_hash)
- htab_delete (line_header_hash);
-
for (dwarf2_per_cu_data *per_cu : all_comp_units)
per_cu->imported_symtabs_free ();
@@ -11059,7 +11056,6 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
{
struct dwarf2_per_objfile *dwarf2_per_objfile
= cu->per_cu->dwarf2_per_objfile;
- struct objfile *objfile = dwarf2_per_objfile->objfile;
struct attribute *attr;
struct line_header line_header_local;
hashval_t line_header_local_hash;
@@ -11084,12 +11080,10 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
&& die->tag == DW_TAG_partial_unit)
{
dwarf2_per_objfile->line_header_hash
- = htab_create_alloc_ex (127, line_header_hash_voidp,
- line_header_eq_voidp,
- free_line_header_voidp,
- &objfile->objfile_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ .reset (htab_create_alloc (127, line_header_hash_voidp,
+ line_header_eq_voidp,
+ free_line_header_voidp,
+ xcalloc, xfree));
}
line_header_local.sect_off = line_offset;
@@ -11097,7 +11091,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
line_header_local_hash = line_header_hash (&line_header_local);
if (dwarf2_per_objfile->line_header_hash != NULL)
{
- slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash,
+ slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (),
&line_header_local,
line_header_local_hash, NO_INSERT);
@@ -11125,7 +11119,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
slot = NULL;
else
{
- slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash,
+ slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (),
&line_header_local,
line_header_local_hash, INSERT);
gdb_assert (slot != NULL);
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 9e08cc1..0f30837 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -220,7 +220,7 @@ public:
std::vector<dwarf2_per_cu_data *> just_read_cus;
/* Table containing line_header indexed by offset and offset_in_dwz. */
- htab_t line_header_hash {};
+ htab_up line_header_hash;
/* Table containing all filenames. This is an optional because the
table is lazily constructed on first access. */