Summary: | [fission] read.c:1713: internal-error: bool dwarf2_per_objfile::symtab_set_p(const dwarf2_per_cu_data*) const: Assertion `per_cu->index < this->m_symtabs.size ()' failed. | ||
---|---|---|---|
Product: | gdb | Reporter: | Tom de Vries <vries> |
Component: | symtab | Assignee: | Tom Tromey <tromey> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | tromey |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 11.1 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Tom de Vries
2021-08-01 17:44:54 UTC
(In reply to Tom Tromey from comment #1) > Looks like the same problem as bug#27893. ... though my patch for that does not fix this, so I guess not. (In reply to Tom Tromey from comment #2) > (In reply to Tom Tromey from comment #1) > > Looks like the same problem as bug#27893. > > ... though my patch for that does not fix this, so I guess not. I think this is because creating these DWO signatured_type objects modifies all_comp_units while it is being iterated. I have a patch for this. (In reply to Tom Tromey from comment #4) > I have a patch for this. The failure still reproduces for me, and the patch ( https://sourceware.org/pipermail/gdb-patches/2021-August/181479.html ) fixes it. The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d58e54bd277b90d847be09ae4b18bfdbc0dc2066 commit d58e54bd277b90d847be09ae4b18bfdbc0dc2066 Author: Tom Tromey <tom@tromey.com> Date: Wed Aug 4 12:44:10 2021 -0600 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 Fixed. The gdb-11-branch branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=de2143d60b9928fa19af00fe3dbb0c8b79b1237b commit de2143d60b9928fa19af00fe3dbb0c8b79b1237b Author: Tom Tromey <tom@tromey.com> Date: Wed Aug 4 12:44:10 2021 -0600 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 (cherry picked from commit d58e54bd277b90d847be09ae4b18bfdbc0dc2066) |