From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: "brobecker@adacore.com" <brobecker@adacore.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Kevin Buettner <kevinb@redhat.com>
Subject: RE: [PATCH v5 10/15] gdb, ada: update ada_add_all_symbols
Date: Mon, 18 Jul 2022 05:36:01 +0000 [thread overview]
Message-ID: <DM8PR11MB574998989F47CD77ABAC2E82DE8C9@DM8PR11MB5749.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220602132514.957983-11-markus.t.metzger@intel.com>
Hello Joel,
Would you be able to review this Ada-related patch?
thanks,
markus.
>-----Original Message-----
>From: Metzger, Markus T <markus.t.metzger@intel.com>
>Sent: Donnerstag, 2. Juni 2022 15:25
>To: gdb-patches@sourceware.org
>Subject: [PATCH v5 10/15] gdb, ada: update ada_add_all_symbols
>
>Iterate over objfile in search order using the objfile of the context
>block as current_objfile so the iteration can stay inside the block's
>linker namespace.
>---
> gdb/ada-lang.c | 66 +++++++++++++++++++++++++++++++++-----------------
> 1 file changed, 44 insertions(+), 22 deletions(-)
>
>diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
>index 20ea4c8f6aa..110c246181e 100644
>--- a/gdb/ada-lang.c
>+++ b/gdb/ada-lang.c
>@@ -5582,37 +5582,52 @@ map_matching_symbols (struct objfile *objfile,
>
> static void
> add_nonlocal_symbols (std::vector<struct block_symbol> &result,
>+ const struct block *block,
> const lookup_name_info &lookup_name,
> domain_enum domain, int global)
> {
>- struct match_data data (&result);
>+ struct objfile *objfile = nullptr;
>+ if (block != nullptr)
>+ objfile = block_objfile (block);
>
> bool is_wild_match = lookup_name.ada ().wild_match_p ();
>
>- for (objfile *objfile : current_program_space->objfiles ())
>- {
>- map_matching_symbols (objfile, lookup_name, is_wild_match, domain,
>- global, data);
>+ match_data data (&result);
>
>- for (compunit_symtab *cu : objfile->compunits ())
>- {
>- const struct block *global_block
>- = cu->blockvector ()->global_block ();
>+ gdbarch_iterate_over_objfiles_in_search_order
>+ (objfile != nullptr ? objfile->arch () : target_gdbarch (),
>+ [&data, lookup_name, domain, global, is_wild_match] (struct objfile *obj)
>+ {
>+ map_matching_symbols (obj, lookup_name, is_wild_match, domain,
>+ global, data);
>
>- if (ada_add_block_renamings (result, global_block, lookup_name,
>- domain))
>- data.found_sym = true;
>- }
>- }
>+ for (compunit_symtab *cu : obj->compunits ())
>+ {
>+ const struct block *global_block
>+ = cu->blockvector ()->global_block ();
>
>- if (result.empty () && global && !is_wild_match)
>+ if (ada_add_block_renamings (*data.resultp, global_block,
>+ lookup_name, domain))
>+ data.found_sym = true;
>+ }
>+
>+ return 0;
>+ }, objfile);
>+
>+ if (data.resultp->empty () && global && !is_wild_match)
> {
> const char *name = ada_lookup_name (lookup_name);
> std::string bracket_name = std::string ("<_ada_") + name + '>';
> lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL);
>
>- for (objfile *objfile : current_program_space->objfiles ())
>- map_matching_symbols (objfile, name1, false, domain, global, data);
>+ gdbarch_iterate_over_objfiles_in_search_order
>+ (objfile != nullptr ? objfile->arch () : target_gdbarch (),
>+ [&data, name1, domain, global] (struct objfile *obj)
>+ {
>+ map_matching_symbols (obj, name1, false, domain, global, data);
>+
>+ return 0;
>+ }, objfile);
> }
> }
>
>@@ -5642,6 +5657,7 @@ ada_add_all_symbols (std::vector<struct
>block_symbol> &result,
> int *made_global_lookup_p)
> {
> struct symbol *sym;
>+ const struct block *orig_block = block;
>
> if (made_global_lookup_p)
> *made_global_lookup_p = 0;
>@@ -5688,15 +5704,21 @@ ada_add_all_symbols (std::vector<struct
>block_symbol> &result,
> if (made_global_lookup_p)
> *made_global_lookup_p = 1;
>
>- /* Search symbols from all global blocks. */
>+ /* Search symbols from all global blocks.
>+
>+ Pass the original block to restrict the search to that block's
>+ namespace. */
>
>- add_nonlocal_symbols (result, lookup_name, domain, 1);
>+ add_nonlocal_symbols (result, orig_block, lookup_name, domain, 1);
>+
>+ /* Now add symbols from all per-file blocks if we've gotten no hits (not
>+ strictly correct, but perhaps better than an error).
>
>- /* Now add symbols from all per-file blocks if we've gotten no hits
>- (not strictly correct, but perhaps better than an error). */
>+ Pass the original block to restrict the search to that block's
>+ namespace. */
>
> if (result.empty ())
>- add_nonlocal_symbols (result, lookup_name, domain, 0);
>+ add_nonlocal_symbols (result, orig_block, lookup_name, domain, 0);
> }
>
> /* Find symbols in DOMAIN matching LOOKUP_NAME, in BLOCK and, if
>FULL_SEARCH
>--
>2.35.3
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2022-07-18 5:36 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 13:24 [PATCH v5 00/15] basic linker namespace support Markus Metzger
2022-06-02 13:25 ` [PATCH v5 01/15] gdb, testsuite: extend gdb_test_multiple checks Markus Metzger
2022-06-13 1:28 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 02/15] gdb, solib-svr4: remove locate_base() Markus Metzger
2022-06-02 23:04 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 03/15] gdb, gdbserver: support dlmopen() Markus Metzger
2022-06-19 4:02 ` Kevin Buettner
2022-06-27 12:55 ` Metzger, Markus T
2022-06-30 22:35 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 04/15] gdbserver: move main_lm handling into caller Markus Metzger
2022-06-19 4:22 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 05/15] gdb, gdbserver: extend RSP to support namespaces Markus Metzger
2022-06-02 16:09 ` Eli Zaretskii
2022-06-19 4:32 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 06/15] gdb, compile: unlink objfile stored in module Markus Metzger
2022-06-23 17:20 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 07/15] gdb, python: use gdbarch_iterate_over_objfiles_in_search_order Markus Metzger
2022-06-24 17:18 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 08/15] gdb, ada: collect standard exceptions in all objfiles Markus Metzger
2022-06-24 17:26 ` Kevin Buettner
2022-07-18 16:49 ` Tom Tromey
2022-07-18 5:35 ` Metzger, Markus T
2022-09-14 8:19 ` Metzger, Markus T
2022-09-14 8:37 ` Joel Brobecker
2022-09-14 8:45 ` Metzger, Markus T
2022-06-02 13:25 ` [PATCH v5 09/15] gdb, ada: update ada_lookup_simple_minsym Markus Metzger
2022-06-24 23:42 ` Kevin Buettner
2022-07-18 17:02 ` Tom Tromey
2022-07-19 7:14 ` Metzger, Markus T
2022-09-14 8:19 ` Metzger, Markus T
2022-09-21 16:11 ` Tom Tromey
2022-06-02 13:25 ` [PATCH v5 10/15] gdb, ada: update ada_add_all_symbols Markus Metzger
2022-06-24 23:53 ` Kevin Buettner
2022-07-18 5:36 ` Metzger, Markus T [this message]
2022-07-18 16:56 ` Tom Tromey
2022-07-19 7:13 ` Metzger, Markus T
2022-07-19 12:23 ` Tom Tromey
2022-07-19 13:49 ` Metzger, Markus T
2022-06-02 13:25 ` [PATCH v5 11/15] gdb, cp: update add_symbol_overload_list_qualified Markus Metzger
2022-06-24 23:59 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 12/15] gdb, hppa: remove unused hppa_lookup_stub_minimal_symbol Markus Metzger
2022-06-25 0:01 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 13/15] gdb, symtab: inline find_quick_global_symbol_language Markus Metzger
2022-06-25 0:16 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 14/15] gdb: update gnu ifunc resolve Markus Metzger
2022-06-25 0:34 ` Kevin Buettner
2022-06-02 13:25 ` [PATCH v5 15/15] gdb, solib-svr4: support namespaces in DSO iteration Markus Metzger
2022-06-25 0:42 ` Kevin Buettner
2022-07-15 10:30 ` [PATCH v5 00/15] basic linker namespace support Metzger, Markus T
2022-07-16 0:04 ` Kevin Buettner
2022-07-18 5:33 ` Metzger, Markus T
2022-10-05 11:16 ` Metzger, Markus T
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM8PR11MB574998989F47CD77ABAC2E82DE8C9@DM8PR11MB5749.namprd11.prod.outlook.com \
--to=markus.t.metzger@intel.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).