[binutils-gdb] Fix Ada failure with gdb-index

Tom Tromey tromey@sourceware.org
Tue Feb 24 15:41:11 GMT 2026


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

commit 28e4086daa9754952f95b5ddc166b37d0a094fc3
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Feb 8 14:39:50 2026 -0700

    Fix Ada failure with gdb-index
    
    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

Diff:
---
 gdb/dwarf2/read-gdb-index.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 2d204737bd2..06fea0ea751 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -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,


More information about the Gdb-cvs mailing list