Improve Ada support in .gdb_index

The cooked index work changed how .gdb_index is constructed, and in
the process broke .gdb_index support.  This is PR symtab/29179.

This patch partially fixes the problem.  It arranges for Ada names to
be encoded in the form expected by the index code.  In particular,
linkage names for Ada are emitted, including the "main" name; names
are Ada-encoded; and names are no longer case-folded, something that
prevented operator names from round-tripping correctly.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
This commit is contained in:
Tom Tromey 2022-09-22 08:43:47 -06:00
parent acd121de32
commit 5fea979432
3 changed files with 41 additions and 13 deletions

View file

@ -1146,12 +1146,14 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
return fold_storage.c_str ();
}
/* The "encoded" form of DECODED, according to GNAT conventions. */
/* The "encoded" form of DECODED, according to GNAT conventions. If
FOLD is true (the default), case-fold any ordinary symbol. Symbols
with <...> quoting are not folded in any case. */
std::string
ada_encode (const char *decoded)
ada_encode (const char *decoded, bool fold)
{
if (decoded[0] != '<')
if (fold && decoded[0] != '<')
decoded = ada_fold_name (decoded);
return ada_encode_1 (decoded, true);
}