aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-05-29 15:35:07 -0600
committerTom Tromey <tom@tromey.com>2021-05-30 19:44:05 -0600
commitc96e8b04d3a8ef41843c7d3fa093b50b597dc7e0 (patch)
tree31dce094d1895a0220cb23617c8af1a2ca40fba5
parent140c5aec0db2d1c27320274ab8aead925a1429fc (diff)
downloadbinutils-c96e8b04d3a8ef41843c7d3fa093b50b597dc7e0.zip
binutils-c96e8b04d3a8ef41843c7d3fa093b50b597dc7e0.tar.gz
binutils-c96e8b04d3a8ef41843c7d3fa093b50b597dc7e0.tar.bz2
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 <tom@tromey.com> * dwarf2/read.h (struct dwarf2_per_bfd) <num_psymtabs, m_num_psymtabs>: Remove. (resize_symtabs): Update. * dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu) (dwarf2_per_bfd::allocate_signatured_type): Update.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/dwarf2/read.c4
-rw-r--r--gdb/dwarf2/read.h15
3 files changed, 12 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 03910c0..ecec841 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2021-05-30 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.h (struct dwarf2_per_bfd) <num_psymtabs,
+ m_num_psymtabs>: 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 <simon.marchi@polymtl.ca>
* Fix tab after space indentation issues throughout.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4cc5b4f..6da3124 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<signatured_type> 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 0bb3da5..07fbb36 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<signatured_type> 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,