X-Git-Url: https://repo.jachan.dev/binutils.git/blobdiff_plain/65558ca5df91470521fda6b0bfdfbbdbd37ce4d3..HEAD:/gdb/ada-lang.c diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 1f26394208..5054bdb295 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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); } @@ -4899,7 +4901,7 @@ add_defn_to_vec (std::vector &result, global symbols are searched. */ struct bound_minimal_symbol -ada_lookup_simple_minsym (const char *name) +ada_lookup_simple_minsym (const char *name, struct objfile *objfile) { struct bound_minimal_symbol result; @@ -4909,19 +4911,23 @@ ada_lookup_simple_minsym (const char *name) symbol_name_matcher_ftype *match_name = ada_get_symbol_name_matcher (lookup_name); - for (objfile *objfile : current_program_space->objfiles ()) - { - for (minimal_symbol *msymbol : objfile->msymbols ()) - { - if (match_name (msymbol->linkage_name (), lookup_name, NULL) - && msymbol->type () != mst_solib_trampoline) - { - result.minsym = msymbol; - result.objfile = objfile; - break; - } - } - } + gdbarch_iterate_over_objfiles_in_search_order + (objfile != NULL ? objfile->arch () : target_gdbarch (), + [&result, lookup_name, match_name] (struct objfile *obj) + { + for (minimal_symbol *msymbol : obj->msymbols ()) + { + if (match_name (msymbol->linkage_name (), lookup_name, nullptr) + && msymbol->type () != mst_solib_trampoline) + { + result.minsym = msymbol; + result.objfile = obj; + return 1; + } + } + + return 0; + }, objfile); return result; } @@ -11999,7 +12005,7 @@ ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex) break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } @@ -12350,7 +12356,7 @@ ada_catchpoint::print_it (const bpstat *bs) const uiout->text (disposition == disp_del ? "\nTemporary catchpoint " : "\nCatchpoint "); - uiout->field_signed ("bkptno", number); + print_num_locno (bs, uiout); uiout->text (", "); /* ada_exception_name_addr relies on the selected frame being the @@ -12469,7 +12475,7 @@ ada_catchpoint::print_one (bp_location **last_loc) const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } @@ -12523,7 +12529,7 @@ ada_catchpoint::print_mention () const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } } @@ -12555,7 +12561,7 @@ ada_catchpoint::print_recreate (struct ui_file *fp) const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); } print_recreate_thread (fp); } @@ -12670,8 +12676,7 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex) return (data->exception_info->catch_handlers_sym); break; default: - internal_error (__FILE__, __LINE__, - _("unexpected catchpoint kind (%d)"), ex); + internal_error (_("unexpected catchpoint kind (%d)"), ex); } } @@ -13018,15 +13023,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); + } + } } } } @@ -13124,6 +13143,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 ())