public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/symtab] Fix assertion in write_debug_names
@ 2023-08-10 13:48 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-08-10 13:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

When running test-case gdb.dwarf2/pr13961.exp with target-board
cc-with-debug-names, I run into:
...
Running gdb.dwarf2/pr13961.exp ...
gdb compile failed, gdb/dwarf2/index-write.c:1305: internal-error: \
  write_debug_names: Assertion `counter == per_bfd->all_units.size ()' failed.
...

This is a regression since commit 542a33e348a ("Only use the per-BFD object to
 write a DWARF index"), which did:
...
-  gdb_assert (counter == per_objfile->per_bfd->all_comp_units.size ());
+  gdb_assert (counter == per_bfd->all_units.size ());
...

Fix this by reverting to using all_comp_units:
...
  gdb_assert (counter == per_bfd->all_comp_units.size ());
...

Tested on x86_64-linux, using target boards unix and cc-with-debug-names.

PR symtab/30741
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30741
---
 gdb/dwarf2/index-write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 66c5378d677..fdc3b97968a 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1302,7 +1302,7 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table,
     }
 
    /* Verify that all units are represented.  */
-  gdb_assert (counter == per_bfd->all_units.size ());
+  gdb_assert (counter == per_bfd->all_comp_units.size ());
   gdb_assert (types_counter == per_bfd->all_type_units.size ());
 
   for (const cooked_index_entry *entry : table->all_entries ())
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-10 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 13:48 [pushed] [gdb/symtab] Fix assertion in write_debug_names Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).