From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1805) id 4B7C93858C83; Tue, 18 Oct 2022 13:25:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B7C93858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666099518; bh=AFrwKKnv4e48GlQuHzi7jN5cnQ3aPIDBbTZrQKaVQ4s=; h=From:To:Subject:Date:From; b=CyvmtHeudL8uubcd3nbdjTt7P3NApl8IMkiYg8qEMJfFETeW5hZIsYoHI2kyeFKDd i1EdBLEpx7CeOb748aYldCyByr/NScj3HOhm+lRlD++M0LBgeZ4CkRPogePui10GeZ qdxdPUj5igF/6QAaPyDlo9xoqVVswM6belGxnvQE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Markus Metzger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb, ada: collect standard exceptions in all objfiles X-Act-Checkin: binutils-gdb X-Git-Author: Markus Metzger X-Git-Refname: refs/heads/master X-Git-Oldrev: 85933f7c91b668e42ae5ff27f432917328828468 X-Git-Newrev: 4326580d4459f82429340f3a96a459178b9eed93 Message-Id: <20221018132518.4B7C93858C83@sourceware.org> Date: Tue, 18 Oct 2022 13:25:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4326580d4459= f82429340f3a96a459178b9eed93 commit 4326580d4459f82429340f3a96a459178b9eed93 Author: Markus Metzger Date: Mon Apr 11 17:58:23 2022 +0200 gdb, ada: collect standard exceptions in all objfiles =20 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. Diff: --- gdb/ada-lang.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index adacf1dd1c9..f4d3f32d339 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13020,15 +13020,29 @@ ada_add_standard_exceptions (compiled_regex *preg, { if (preg =3D=3D NULL || preg->exec (name, 0, NULL, 0) =3D=3D 0) { - struct bound_minimal_symbol msymbol - =3D ada_lookup_simple_minsym (name); + symbol_name_match_type match_type =3D name_match_type_from_name (name); + lookup_name_info lookup_name (name, match_type); =20 - if (msymbol.minsym !=3D NULL) - { - struct ada_exc_info info - =3D {name, msymbol.value_address ()}; + symbol_name_matcher_ftype *match_name + =3D ada_get_symbol_name_matcher (lookup_name); =20 - 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 () !=3D mst_solib_trampoline) + { + ada_exc_info info + =3D {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); =20 + /* 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 ())