public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed.
@ 2022-08-02  7:16 vries at gcc dot gnu.org
  2022-08-02  7:52 ` [Bug symtab/29436] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-02  7:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29436
           Summary: [gdb/symtab] read.c:2352: internal-error:
                    read_addrmap_from_aranges: Assertion
                    `insertpair.second' 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: ---

I recently added this assert:
...
      /* Assume no duplicate offsets in all_comp_units.  */
      gdb_assert (insertpair.second);
...
in read_addrmap_from_aranges, and I was curious if I could trigger it.

So I started out with:
...
$ gcc ~/hello.c -g -save-temps
...
and then manually added this (copied and modified from
gdb.dwarf2/clang-debug-names.exp.tcl):
...
        .ident  "GCC: (SUSE Linux) 7.5.0"

+       .section .debug_names
+       .4byte  .Ldebug_names_end - .Ldebug_names_start
+       .Ldebug_names_start:
+       .short 5                     /* Header: version */
+       .short 0                     /* Header: padding */
+       .long 2                      /* Header: compilation unit count */
+       .long 0                      /* Header: local type unit count */
+       .long 0                      /* Header: foreign type unit count */
+       .long 0                      /* Header: bucket count */
+       .long 0                      /* Header: name count */
+       .long 1
+                                    /* Header: abbreviation table size */ 
+       .long 0                      /* Header: augmentation string size */
+        .long .Ldebug_info0            /* Compilation unit 0 */
+        .long .Ldebug_info0            /* Compilation unit 0 */
+       .byte 0
+        .p2align 2
+       .Ldebug_names_end:
+
        .section        .note.GNU-stack,"",@progbits
...
in hello.s.

[ Actually, I started out with abbreviation table size 0, but gdb doesn't grok
it, it always expects a terminating byte. ]

This is an empty index, and this bit:
...
   /* Don't use the index if it's empty.  */
   if (map->name_count == 0)
     return false;
...
in dwarf2_read_debug_names prevents us from using it, but after disabling it we
have indeed:
...
$ gdb -q -batch a.out
src/gdb/dwarf2/read.c:2352: internal-error: read_addrmap_from_aranges:
Assertion `insertpair.second' failed.
...

We should handle this in create_cus_from_debug_names_list or some such. 
Likewise for .gdb_index.

Note btw that the standard bit that is violated here is:  "For a per-module
index, there will be one CU entry for each compile unit in the module".

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

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

* [Bug symtab/29436] [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed.
  2022-08-02  7:16 [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed vries at gcc dot gnu.org
@ 2022-08-02  7:52 ` vries at gcc dot gnu.org
  2022-08-02  7:54 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-02  7:52 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> +       .long 0                      /* Header: augmentation string size */

In order to trigger the map.augmentation_is_gdb case in
create_cus_from_debug_names_list, I've changed this to:
...
        .long 4                      /* Header: augmentation string size */
        .ascii "GDB\0"   /* Header: augmentation string */
...

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

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

* [Bug symtab/29436] [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed.
  2022-08-02  7:16 [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed vries at gcc dot gnu.org
  2022-08-02  7:52 ` [Bug symtab/29436] " vries at gcc dot gnu.org
@ 2022-08-02  7:54 ` vries at gcc dot gnu.org
  2022-08-05 11:43 ` vries at gcc dot gnu.org
  2022-08-08  8:19 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-02  7:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14249
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14249&action=edit
tentative patch

Gets us:
...
$ gdb -q -batch a.out 

warning: Section .debug_names has duplicate entry in CU table,ignoring
.debug_names.
...

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

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

* [Bug symtab/29436] [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed.
  2022-08-02  7:16 [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed vries at gcc dot gnu.org
  2022-08-02  7:52 ` [Bug symtab/29436] " vries at gcc dot gnu.org
  2022-08-02  7:54 ` vries at gcc dot gnu.org
@ 2022-08-05 11:43 ` vries at gcc dot gnu.org
  2022-08-08  8:19 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-05 11:43 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-August/191230.html

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

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

* [Bug symtab/29436] [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed.
  2022-08-02  7:16 [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-08-05 11:43 ` vries at gcc dot gnu.org
@ 2022-08-08  8:19 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-08  8:19 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c7cd10637c40a72564bc813f3f16a4ba4b13d21b

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

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

end of thread, other threads:[~2022-08-08  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  7:16 [Bug symtab/29436] New: [gdb/symtab] read.c:2352: internal-error: read_addrmap_from_aranges: Assertion `insertpair.second' failed vries at gcc dot gnu.org
2022-08-02  7:52 ` [Bug symtab/29436] " vries at gcc dot gnu.org
2022-08-02  7:54 ` vries at gcc dot gnu.org
2022-08-05 11:43 ` vries at gcc dot gnu.org
2022-08-08  8:19 ` 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).