public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/30741] [gdb/symtab, cc-with-debug-names] gdb/dwarf2/index-write.c:1305: internal-error: write_debug_names: Assertion `counter == per_bfd->all_units.size ()' failed.
Date: Thu, 10 Aug 2023 10:22:26 +0000	[thread overview]
Message-ID: <bug-30741-4717-3njfDK8n6M@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30741-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30741

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
The assert fails because:
...
(gdb) 
#6  0x00000000006d9e63 in write_debug_names (per_bfd=0x35bff20,
table=0x35c6ea0, out_file=0x2be7d80, 
    out_file_str=0x35c8a10) at
/data/vries/gdb/src/gdb/dwarf2/index-write.c:1305
1305      gdb_assert (counter == per_bfd->all_units.size ());
(gdb) p counter
$1 = 6
(gdb) p per_bfd->all_units.size ()
$2 = 7
...

The .debug_info section has 6 CUs, the .debug_types section has 1.

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

Fixed by reverting to all_comp_units.size:
...
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 ())
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2023-08-10 10:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 10:01 [Bug symtab/30741] New: " vries at gcc dot gnu.org
2023-08-10 10:22 ` vries at gcc dot gnu.org [this message]
2023-08-10 13:46 ` [Bug symtab/30741] " cvs-commit at gcc dot gnu.org
2023-08-10 13:51 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30741-4717-3njfDK8n6M@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).