From c96e8b04d3a8ef41843c7d3fa093b50b597dc7e0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 29 May 2021 15:35:07 -0600 Subject: [PATCH] Remove dwarf2_per_bfd::m_num_psymtabs Now that CUs and TUs are stored together in all_comp_units, the m_num_psymtabs member is no longer needed -- it is always identical to the length of the vector. This patch removes it. 2021-05-30 Tom Tromey * dwarf2/read.h (struct dwarf2_per_bfd) : Remove. (resize_symtabs): Update. * dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu) (dwarf2_per_bfd::allocate_signatured_type): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 4 ++-- gdb/dwarf2/read.h | 15 ++------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 03910c0634c..ecec841d860 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2021-05-30 Tom Tromey + + * dwarf2/read.h (struct dwarf2_per_bfd) : Remove. + (resize_symtabs): Update. + * dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu) + (dwarf2_per_bfd::allocate_signatured_type): Update. + 2021-05-27 Simon Marchi * Fix tab after space indentation issues throughout. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4cc5b4f32d7..6da31241367 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2288,7 +2288,7 @@ dwarf2_per_bfd::allocate_per_cu () { dwarf2_per_cu_data_up result (new dwarf2_per_cu_data); result->per_bfd = this; - result->index = m_num_psymtabs++; + result->index = all_comp_units.size (); return result; } @@ -2299,7 +2299,7 @@ dwarf2_per_bfd::allocate_signatured_type () { std::unique_ptr result (new signatured_type); result->per_bfd = this; - result->index = m_num_psymtabs++; + result->index = all_comp_units.size (); tu_stats.nr_tus++; return result; } diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 0bb3da5a34a..07fbb36c419 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -124,11 +124,6 @@ struct dwarf2_per_bfd is allocated on the dwarf2_per_bfd obstack. */ std::unique_ptr allocate_signatured_type (); - /* Return the number of partial symtabs allocated with allocate_per_cu - and allocate_signatured_type so far. */ - int num_psymtabs () const - { return m_num_psymtabs; } - private: /* This function is mapped across the sections and remembers the offset and size of each of the debugging sections we are @@ -249,12 +244,6 @@ public: /* The address map that is used by the DWARF index code. */ struct addrmap *index_addrmap = nullptr; - -private: - - /* The total number of per_cu and signatured_type objects that have - been created so far for this reader. */ - size_t m_num_psymtabs = 0; }; /* This is the per-objfile data associated with a type_unit_group. */ @@ -307,9 +296,9 @@ struct dwarf2_per_objfile void resize_symtabs () { /* The symtabs vector should only grow, not shrink. */ - gdb_assert (per_bfd->num_psymtabs () >= m_symtabs.size ()); + gdb_assert (per_bfd->all_comp_units.size () >= m_symtabs.size ()); - m_symtabs.resize (per_bfd->num_psymtabs ()); + m_symtabs.resize (per_bfd->all_comp_units.size ()); } /* Return true if the symtab corresponding to PER_CU has been set, -- 2.30.2