aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-06-05 08:19:34 -0600
committerTom Tromey <tromey@adacore.com>2024-06-24 09:11:29 -0600
commit5e6ab40868d81401c6f239a368d2db759f5e2947 (patch)
tree7ae6691da3fa5d3979e5ab5324eae3abb69f812f
parent7682ef5a19d4fbd6ad431826f530393ce8d84c43 (diff)
downloadbinutils-5e6ab40868d81401c6f239a368d2db759f5e2947.zip
binutils-5e6ab40868d81401c6f239a368d2db759f5e2947.tar.gz
binutils-5e6ab40868d81401c6f239a368d2db759f5e2947.tar.bz2
Don't obstack-allocate the CU dependency hash table
The CU dependency hash table is obstack-allocated, but there's no need to do this.
-rw-r--r--gdb/dwarf2/cu.c12
-rw-r--r--gdb/dwarf2/cu.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c
index a64cb1d..aae61cc 100644
--- a/gdb/dwarf2/cu.c
+++ b/gdb/dwarf2/cu.c
@@ -146,7 +146,7 @@ dwarf2_cu::mark ()
{
m_mark = true;
if (m_dependencies != nullptr)
- htab_traverse (m_dependencies, dwarf2_mark_helper, per_objfile);
+ htab_traverse (m_dependencies.get (), dwarf2_mark_helper, per_objfile);
}
}
@@ -158,13 +158,11 @@ dwarf2_cu::add_dependence (struct dwarf2_per_cu_data *ref_per_cu)
void **slot;
if (m_dependencies == nullptr)
- m_dependencies
- = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
- NULL, &comp_unit_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ m_dependencies.reset (htab_create_alloc
+ (5, htab_hash_pointer, htab_eq_pointer,
+ nullptr, xcalloc, xfree));
- slot = htab_find_slot (m_dependencies, ref_per_cu, INSERT);
+ slot = htab_find_slot (m_dependencies.get (), ref_per_cu, INSERT);
if (*slot == nullptr)
*slot = ref_per_cu;
}
diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index 94e73eb..d23cc9b 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -122,7 +122,7 @@ private:
/* A set of pointers to dwarf2_per_cu_data objects for compilation
units referenced by this one. Only set during full symbol processing;
partial symbol tables do not have dependencies. */
- htab_t m_dependencies = nullptr;
+ htab_up m_dependencies;
public:
/* The generic symbol table building routines have separate lists for