aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-03-10 15:52:17 -0600
committerTom Tromey <tom@tromey.com>2025-09-10 16:05:27 -0600
commit27de7d7bc3c16137f03a5be2d5da2b7687200eff (patch)
treef8508d313dc6b3b3088aad4b90c64e35ceffd214
parent4ca244e7db3a9302bf49558f09c3c37f028e01d9 (diff)
downloadbinutils-27de7d7bc3c16137f03a5be2d5da2b7687200eff.zip
binutils-27de7d7bc3c16137f03a5be2d5da2b7687200eff.tar.gz
binutils-27de7d7bc3c16137f03a5be2d5da2b7687200eff.tar.bz2
Add another minor hack to cooked_index_entry::full_name
This patch adds another minor hack to cooked_index_entry::full_name. In particular, if GNAT emits non-hierarchical names (still the default as the hierarchical series is blocked on one tricky problem), then a request to compute the "linkage-style" name will now just return the 'name' field. Without this tweak, this series would regress ada-cold-name.exp, because the search would look for "name.cold" but the index would return "name[cold]" as the "linkage" name (which would be wrong). This area is a bit difficult to unravel. The best plan here, IMO, is to change Ada to work like the other languages in gdb: store the natural name and do searches with that name. I think this is achievable, but I didn't want to try it here. I've updated the relevant bug (tagged below) to reflect this. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32766 Acked-By: Simon Marchi <simon.marchi@efficios.com>
-rw-r--r--gdb/dwarf2/cooked-index-entry.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/dwarf2/cooked-index-entry.c b/gdb/dwarf2/cooked-index-entry.c
index a5e3fcb..0482b64 100644
--- a/gdb/dwarf2/cooked-index-entry.c
+++ b/gdb/dwarf2/cooked-index-entry.c
@@ -188,8 +188,15 @@ cooked_index_entry::full_name (struct obstack *storage,
break;
case language_ada:
+ /* If GNAT emits hierarchical names (patches not in at the time
+ of writing), then we need to compute the linkage name here.
+ However for traditional GNAT, the linkage name will be in
+ 'name'. Detect this by looking for "__"; see also
+ cooked_index_shard::finalize. */
if ((name_flags & FOR_ADA_LINKAGE_NAME) != 0)
{
+ if (strstr (name, "__") != nullptr)
+ return name;
sep = "__";
break;
}