]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix incorrect .gdb_index with new DWARF scanner
authorTom Tromey <tromey@adacore.com>
Mon, 17 Oct 2022 18:21:10 +0000 (12:21 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 21 Oct 2022 15:54:38 +0000 (09:54 -0600)
commit2afd002ac6acb01763d643686345cc0c6ad564bd
treefb27197f49373e6455523b3180494eca98981283
parente379f6521a9fbc65de8cd90a950e28d0ca522ae3
Fix incorrect .gdb_index with new DWARF scanner

PR symtab/29694 points out a regression caused by the new DWARF
scanner when the cc-with-gdb-index target board is used.

What happens here is that an older version of gdb will make an index
describing the "A" type as:

[737] A: 1 [global, type]

whereas the new gdb says:

[1008] A: 0 [global, type]

Here the old one is correct because the A in CU 0 is just a
declaration without a size:

 <1><45>: Abbrev Number: 10 (DW_TAG_structure_type)
    <46>   DW_AT_name        : A
    <48>   DW_AT_declaration : 1
    <48>   DW_AT_sibling     : <0x6d>

This patch fixes the problem by introducing the idea of a "type
declaration".  I think gdb still needs to recurse into these types,
searching for methods, but by marking the type itself as a
declaration, gdb can skip this type during lookups and when writing
the index.

Regression tested on x86-64 using the cc-with-gdb-index board.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29694
gdb/dwarf2/cooked-index.h
gdb/dwarf2/index-write.c
gdb/dwarf2/read.c