aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-08-04 12:44:10 -0600
committerTom Tromey <tom@tromey.com>2021-08-24 07:51:46 -0600
commitd58e54bd277b90d847be09ae4b18bfdbc0dc2066 (patch)
tree795411324aaa18a5f9f7df1d6fc33bd98aa3461d /gdb/dwarf2/read.h
parent5c133c109550321c84d25bf084828bb02219d019 (diff)
downloadfsf-binutils-gdb-d58e54bd277b90d847be09ae4b18bfdbc0dc2066.zip
fsf-binutils-gdb-d58e54bd277b90d847be09ae4b18bfdbc0dc2066.tar.gz
fsf-binutils-gdb-d58e54bd277b90d847be09ae4b18bfdbc0dc2066.tar.bz2
Fix two regressions caused by CU / TU merging
PR symtab/28160 and PR symtab/27893 concern GDB crashes in the test suite when using the "fission" target board. They are both caused by the patches that merge the list of CUs with the list of TUs (and to a lesser degree by the patches to share DWARF data across objfiles), and the underlying issue is the same: it turns out that reading a DWO can cause new type units to be created. This means that the list of dwarf2_per_cu_data objects depends on precisely which CUs have been expanded. However, because the type units can be created while expanding a CU means that the vector of CUs can expand while it is being iterated over -- a classic mistake. Also, because a TU can be added later, it means the resize_symtabs approach is incorrect. This patch fixes resize_symtabs by removing it, and having set_symtab resize the vector on demand. It fixes the iteration problem by introducing a safe (index-based) iterator and changing the relevant spots to use it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28160 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27893
Diffstat (limited to 'gdb/dwarf2/read.h')
-rw-r--r--gdb/dwarf2/read.h10
1 files changed, 0 insertions, 10 deletions
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 08ef179..b57e1f9 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -517,16 +517,6 @@ struct dwarf2_per_objfile
const struct comp_unit_head *cu_header,
unsigned int *bytes_read_ptr);
- /* Resize the M_SYMTABS vector to the needed size (the number of partial
- symtabs allocated by the per-bfd). */
- void resize_symtabs ()
- {
- /* The symtabs vector should only grow, not shrink. */
- gdb_assert (per_bfd->all_comp_units.size () >= m_symtabs.size ());
-
- m_symtabs.resize (per_bfd->all_comp_units.size ());
- }
-
/* Return true if the symtab corresponding to PER_CU has been set,
false otherwise. */
bool symtab_set_p (const dwarf2_per_cu_data *per_cu) const;