public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Simplify some symbol searches in Ada code
@ 2024-01-28 23:44 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-01-28 23:44 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54d186cf6554099057d76c7a4df730423eefe977

commit 54d186cf6554099057d76c7a4df730423eefe977
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Nov 16 18:02:14 2023 -0700

    Simplify some symbol searches in Ada code
    
    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.

Diff:
---
 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 1f439b38aea..ab936ae4733 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 a15ea7b725e..f1d01ec7aa3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7436,14 +7436,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 21f81bbcdea..1a0bc1d528e 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 ());

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-28 23:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 23:44 [binutils-gdb] Simplify some symbol searches in Ada code Tom Tromey

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).