aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-10-23 11:17:51 -0600
committerTom Tromey <tromey@adacore.com>2025-03-06 14:17:18 -0700
commitf83d71e9c797904c2865e9ae389f8f6404ccd604 (patch)
tree44c4f9f23f58238562a9e9c7c2de90fbe96fe827 /gdb/ada-lang.c
parentaa24bf2c05f80eb106189d55469cd393f752fa92 (diff)
downloadbinutils-f83d71e9c797904c2865e9ae389f8f6404ccd604.zip
binutils-f83d71e9c797904c2865e9ae389f8f6404ccd604.tar.gz
binutils-f83d71e9c797904c2865e9ae389f8f6404ccd604.tar.bz2
Update ada_add_block_renamings for compiler changes
With the hierarchical name patches to GNAT, ada_add_block_renamings must now be updated as well -- the comment there about the supported forms of DW_TAG_imported_declaration is no longer correct, and now full names must sometimes be constructed during the lookup process.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ab92f64..a55ee12 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5426,17 +5426,9 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
const char *r_name;
/* Avoid infinite recursions: skip this renaming if we are actually
- already traversing it.
-
- Currently, symbol lookup in Ada don't use the namespace machinery from
- C++/Fortran support: skip namespace imports that use them. */
- if (renaming->searched
- || (renaming->import_src != NULL
- && renaming->import_src[0] != '\0')
- || (renaming->import_dest != NULL
- && renaming->import_dest[0] != '\0'))
+ already traversing it. */
+ if (renaming->searched)
continue;
- renaming->searched = 1;
/* TODO: here, we perform another name-based symbol lookup, which can
pull its own multiple overloads. In theory, we should be able to do
@@ -5448,14 +5440,33 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
r_name = (renaming->alias != NULL
? renaming->alias
: renaming->declaration);
+ if (r_name == nullptr)
+ continue;
+
+ scoped_restore reset_searched
+ = make_scoped_restore (&renaming->searched, 1);
+ std::string storage;
+ if (renaming->import_src != nullptr && renaming->import_src[0] != '\0')
+ {
+ storage = std::string (renaming->import_src) + "__" + r_name;
+ r_name = storage.c_str ();
+ }
+
if (name_match (r_name, lookup_name, NULL))
{
- lookup_name_info decl_lookup_name (renaming->declaration,
+ r_name = renaming->declaration;
+ if (renaming->import_dest != nullptr
+ && renaming->import_dest[0] != '\0')
+ {
+ storage = std::string (renaming->import_dest) + "__" + r_name;
+ r_name = storage.c_str ();
+ }
+
+ lookup_name_info decl_lookup_name (r_name,
lookup_name.match_type ());
ada_add_all_symbols (result, block, decl_lookup_name, domain,
1, NULL);
}
- renaming->searched = 0;
}
return result.size () != defns_mark;
}