]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix Ada failure with gdb-index
authorTom Tromey <tom@tromey.com>
Sun, 8 Feb 2026 21:39:50 +0000 (14:39 -0700)
committerTom Tromey <tom@tromey.com>
Tue, 24 Feb 2026 15:41:00 +0000 (08:41 -0700)
The gdb index reader rewrite (commit 486bc5ac) broke a couple of Ada
test cases.  I didn't notice these at the time because they require
libgnat debuginfo to be installed.

This patch fixes the problem.  The issue here is that the Ada code
sometimes requires types to have "linkage name" entries.  This is
required because these lookups are done using the verbatim ("<...>")
notation, which won't match the split names in the index.

Removing the need for this is on my wish-list, see PR ada/32142; but I
have not gotten around to figuring this one out yet.

In the meantime, having the gdb-index reader create synthetic linkage
name entries for types fixes the bug.

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

gdb/dwarf2/read-gdb-index.c

index 2d204737bd29b8cc36a32ef94af9521d74e69a74..06fea0ea7519bff185123fe2a48fd67787893028 100644 (file)
@@ -323,6 +323,13 @@ mapped_gdb_index::build_name_components (dwarf2_per_objfile *per_objfile)
              main_name = nullptr;
            }
 
+         if (this_lang == language_ada
+             && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
+           result.add (per_cu->sect_off (), tag,
+                       flags | IS_LINKAGE | IS_SYNTHESIZED, this_lang,
+                       components.back ().data (),
+                       nullptr, per_cu);
+
          /* Note that this assumes the final component ends in \0.  */
          cooked_index_entry *entry = result.add (per_cu->sect_off (), tag,
                                                  flags, this_lang,