public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30741] New: [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.
@ 2023-08-10 10:01 vries at gcc dot gnu.org
  2023-08-10 10:22 ` [Bug symtab/30741] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-10 10:01 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30741
           Summary: [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.
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When running test-case gdb.dwarf2/pr13961.exp with target-board
cc-with-debug-names, I run into:
...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/pr13961.exp ...
gdb compile failed, /data/vries/gdb/src/gdb/dwarf2/index-write.c:1305:
internal-error: write_debug_names: Assertion `counter ==
per_bfd->all_units.size ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x59f3a4 gdb_internal_backtrace_1
        /data/vries/gdb/src/gdb/bt-utils.c:122
0x59f447 _Z22gdb_internal_backtracev
        /data/vries/gdb/src/gdb/bt-utils.c:168
0xd06ae4 internal_vproblem
        /data/vries/gdb/src/gdb/utils.c:396
0xd06eb3 _Z15internal_verrorPKciS0_P13__va_list_tag
        /data/vries/gdb/src/gdb/utils.c:476
0x14a622a _Z18internal_error_locPKciS0_z
        /data/vries/gdb/src/gdbsupport/errors.cc:58
0x6d9e62 write_debug_names
        /data/vries/gdb/src/gdb/dwarf2/index-write.c:1305
0x6da547 _Z17write_dwarf_indexP14dwarf2_per_bfdPKcS2_S2_13dw_index_kind
        /data/vries/gdb/src/gdb/dwarf2/index-write.c:1463
0x6da87b save_gdb_index_command
        /data/vries/gdb/src/gdb/dwarf2/index-write.c:1524
0x5f7f5a do_simple_func
        /data/vries/gdb/src/gdb/cli/cli-decode.c:95
0x5fcf6e _Z8cmd_funcP16cmd_list_elementPKci
        /data/vries/gdb/src/gdb/cli/cli-decode.c:2735
0xc5fc93 _Z15execute_commandPKci
        /data/vries/gdb/src/gdb/top.c:575
0x91ad4a catch_command_errors
        /data/vries/gdb/src/gdb/main.c:518
0x91af56 execute_cmdargs
        /data/vries/gdb/src/gdb/main.c:617
0x91c280 captured_main_1
        /data/vries/gdb/src/gdb/main.c:1289
0x91c483 captured_main
        /data/vries/gdb/src/gdb/main.c:1310
0x91c522 _Z8gdb_mainP18captured_main_args
        /data/vries/gdb/src/gdb/main.c:1339
0x419602 main
        /data/vries/gdb/src/gdb/gdb.c:39
...

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [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.
  2023-08-10 10:01 [Bug symtab/30741] New: [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 vries at gcc dot gnu.org
@ 2023-08-10 10:22 ` vries at gcc dot gnu.org
  2023-08-10 13:46 ` cvs-commit at gcc dot gnu.org
  2023-08-10 13:51 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-10 10:22 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [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.
  2023-08-10 10:01 [Bug symtab/30741] New: [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 vries at gcc dot gnu.org
  2023-08-10 10:22 ` [Bug symtab/30741] " vries at gcc dot gnu.org
@ 2023-08-10 13:46 ` cvs-commit at gcc dot gnu.org
  2023-08-10 13:51 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-10 13:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=62a21046a98d081b5ac07afd0099dfd06465922c

commit 62a21046a98d081b5ac07afd0099dfd06465922c
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Aug 10 15:46:30 2023 +0200

    [gdb/symtab] Fix assertion in write_debug_names

    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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [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.
  2023-08-10 10:01 [Bug symtab/30741] New: [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 vries at gcc dot gnu.org
  2023-08-10 10:22 ` [Bug symtab/30741] " vries at gcc dot gnu.org
  2023-08-10 13:46 ` cvs-commit at gcc dot gnu.org
@ 2023-08-10 13:51 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-10 13:51 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.1

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-10 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 10:01 [Bug symtab/30741] New: [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 vries at gcc dot gnu.org
2023-08-10 10:22 ` [Bug symtab/30741] " vries at gcc dot gnu.org
2023-08-10 13:46 ` cvs-commit at gcc dot gnu.org
2023-08-10 13:51 ` vries at gcc dot gnu.org

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).