aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2022-04-11 17:58:23 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2022-10-18 14:16:09 +0200
commit4326580d4459f82429340f3a96a459178b9eed93 (patch)
treed5c9cb788d5d6f6c27fcf01f21633782bf31db25 /gdb/ada-lang.c
parent85933f7c91b668e42ae5ff27f432917328828468 (diff)
downloadgdb-4326580d4459f82429340f3a96a459178b9eed93.zip
gdb-4326580d4459f82429340f3a96a459178b9eed93.tar.gz
gdb-4326580d4459f82429340f3a96a459178b9eed93.tar.bz2
gdb, ada: collect standard exceptions in all objfiles
When searching for standard exceptions for Ada, we lookup the minimal symbol of each exception. With linker namespaces there can be multiple instances in different namespaces. Collect them all.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index adacf1d..f4d3f32 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13020,15 +13020,29 @@ ada_add_standard_exceptions (compiled_regex *preg,
{
if (preg == NULL || preg->exec (name, 0, NULL, 0) == 0)
{
- struct bound_minimal_symbol msymbol
- = ada_lookup_simple_minsym (name);
+ symbol_name_match_type match_type = name_match_type_from_name (name);
+ lookup_name_info lookup_name (name, match_type);
- if (msymbol.minsym != NULL)
- {
- struct ada_exc_info info
- = {name, msymbol.value_address ()};
+ symbol_name_matcher_ftype *match_name
+ = ada_get_symbol_name_matcher (lookup_name);
- exceptions->push_back (info);
+ /* Iterate over all objfiles irrespective of scope or linker
+ namespaces so we get all exceptions anywhere in the
+ progspace. */
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+ for (minimal_symbol *msymbol : objfile->msymbols ())
+ {
+ if (match_name (msymbol->linkage_name (), lookup_name,
+ nullptr)
+ && msymbol->type () != mst_solib_trampoline)
+ {
+ ada_exc_info info
+ = {name, msymbol->value_address (objfile)};
+
+ exceptions->push_back (info);
+ }
+ }
}
}
}
@@ -13126,6 +13140,8 @@ ada_add_global_exceptions (compiled_regex *preg,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
VARIABLES_DOMAIN);
+ /* Iterate over all objfiles irrespective of scope or linker namespaces
+ so we get all exceptions anywhere in the progspace. */
for (objfile *objfile : current_program_space->objfiles ())
{
for (compunit_symtab *s : objfile->compunits ())