From: Tom Tromey Date: Wed, 5 Jun 2024 14:19:34 +0000 (-0600) Subject: Don't obstack-allocate the CU dependency hash table X-Git-Tag: binutils-2_43~305 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e6ab40868d81401c6f239a368d2db759f5e2947;p=thirdparty%2Fbinutils-gdb.git 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. --- diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index a64cb1d8380..aae61cccd21 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 94e73eb3813..d23cc9b70e5 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