From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 20/29] Simplify some symbol searches in Ada code
Date: Mon, 20 Nov 2023 20:53:51 -0700 [thread overview]
Message-ID: <20231120-submit-domain-hacks-2-v1-20-29650d01b198@tromey.com> (raw)
In-Reply-To: <20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com>
This changes some of the Ada code to simplify symbol searches. For
example, if a function is being looked for, the search is narrowed to
use SEARCH_FUNCTION_DOMAIN rather than SEARCH_VFT. In one spot, a
search of the "struct" domain is removed, because Ada does not have a
tag domain.
---
gdb/ada-exp.y | 4 ++--
gdb/ada-lang.c | 10 ++--------
gdb/dwarf2/ada-imported.c | 2 +-
3 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index df7a85f101d..613e284c166 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1404,7 +1404,7 @@ block_lookup (const struct block *context, const char *raw_name)
}
std::vector<struct block_symbol> syms
- = ada_lookup_symbol_list (name, context, SEARCH_VFT);
+ = ada_lookup_symbol_list (name, context, SEARCH_FUNCTION_DOMAIN);
if (context == NULL
&& (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK))
@@ -1483,7 +1483,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
(char *) alloca (strlen (name) + sizeof ("standard__"));
strcpy (expanded_name, "standard__");
strcat (expanded_name, name);
- sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_VFT).symbol;
+ sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_TYPE_DOMAIN).symbol;
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
type = sym->type ();
}
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ad5fac05468..6efc4819088 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7496,14 +7496,8 @@ field_alignment (struct type *type, int f)
static struct symbol *
ada_find_any_type_symbol (const char *name)
{
- struct symbol *sym;
-
- sym = standard_lookup (name, get_selected_block (NULL), SEARCH_VFT);
- if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
- return sym;
-
- sym = standard_lookup (name, NULL, SEARCH_STRUCT_DOMAIN);
- return sym;
+ return standard_lookup (name, get_selected_block (nullptr),
+ SEARCH_TYPE_DOMAIN);
}
/* Find a type named NAME. Ignores ambiguity. This routine will look
diff --git a/gdb/dwarf2/ada-imported.c b/gdb/dwarf2/ada-imported.c
index bfcfb779105..13d61a354c1 100644
--- a/gdb/dwarf2/ada-imported.c
+++ b/gdb/dwarf2/ada-imported.c
@@ -103,7 +103,7 @@ ada_alias_get_block_value (const struct symbol *sym)
{
const char *name = get_imported_name (sym);
block_symbol real_symbol = lookup_global_symbol (name, nullptr,
- SEARCH_VFT);
+ SEARCH_FUNCTION_DOMAIN);
if (real_symbol.symbol == nullptr)
error (_("could not find alias '%s' for function '%s'"),
name, sym->print_name ());
--
2.41.0
next prev parent reply other threads:[~2023-11-21 3:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 3:53 [PATCH 00/29] Restructure symbol domains Tom Tromey
2023-11-21 3:53 ` [PATCH 01/29] Fix bug in cooked index scanner Tom Tromey
2023-11-21 3:53 ` [PATCH 02/29] Small cleanup in DWARF reader Tom Tromey
2023-11-21 3:53 ` [PATCH 03/29] Make nsalias.exp more reliable Tom Tromey
2023-11-21 3:53 ` [PATCH 04/29] Fix latent bug in mdebugread.c Tom Tromey
2023-11-21 3:53 ` [PATCH 05/29] Give names to unspecified types Tom Tromey
2023-11-21 3:53 ` [PATCH 06/29] Remove NR_DOMAINS Tom Tromey
2023-11-21 3:53 ` [PATCH 07/29] Simplify symbol_to_info_string Tom Tromey
2023-11-21 3:53 ` [PATCH 08/29] Split up a big 'if' in symtab.c Tom Tromey
2023-11-21 3:53 ` [PATCH 09/29] Use a .def file for domain_enum Tom Tromey
2023-11-21 3:53 ` [PATCH 10/29] Add two new symbol domains Tom Tromey
2023-11-21 3:53 ` [PATCH 11/29] Add domain_search_flags Tom Tromey
2023-11-21 3:53 ` [PATCH 12/29] Replace search_domain with domain_search_flags Tom Tromey
2023-11-21 3:53 ` [PATCH 13/29] Remove a check of VAR_DOMAIN Tom Tromey
2023-11-21 3:53 ` [PATCH 14/29] Introduce "scripting" domains Tom Tromey
2023-11-21 3:53 ` [PATCH 15/29] Use domain_search_flags in lookup_global_symbol_language Tom Tromey
2023-11-21 3:53 ` [PATCH 16/29] Use domain_search_flags in lookup_symbol et al Tom Tromey
2023-11-21 3:53 ` [PATCH 17/29] Remove some obsolete Python constants Tom Tromey
2023-11-21 3:53 ` [PATCH 18/29] Remove old symbol_matches_domain Tom Tromey
2023-11-21 3:53 ` [PATCH 19/29] Use the new symbol domains Tom Tromey
2023-11-21 3:53 ` Tom Tromey [this message]
2023-11-21 3:53 ` [PATCH 21/29] Simplify some symbol searches in linespec.c Tom Tromey
2023-11-21 3:53 ` [PATCH 22/29] Only search for "main" as a function Tom Tromey
2023-11-21 3:53 ` [PATCH 23/29] Only look for functions in expand_symtabs_for_function Tom Tromey
2023-11-21 3:53 ` [PATCH 24/29] Use a function-domain search in inside_main_func Tom Tromey
2023-11-21 3:53 ` [PATCH 25/29] Only search types in cp_lookup_rtti_type Tom Tromey
2023-11-21 3:53 ` [PATCH 26/29] Only search types in lookup_typename Tom Tromey
2023-11-21 3:53 ` [PATCH 27/29] Only search for functions in rust_structop::evaluate_funcall Tom Tromey
2023-11-21 3:53 ` [PATCH 28/29] Refine search in cp_search_static_and_baseclasses Tom Tromey
2023-11-21 3:54 ` [PATCH 29/29] Document new Python and Guile constants Tom Tromey
2023-11-21 11:39 ` Eli Zaretskii
2024-01-23 0:34 ` Tom Tromey
2024-01-23 18:11 ` Eli Zaretskii
2023-11-21 18:37 ` [PATCH 00/29] Restructure symbol domains John Baldwin
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=20231120-submit-domain-hacks-2-v1-20-29650d01b198@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/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).