]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move search_symbol_list to symtab.c
authorTom Tromey <tromey@adacore.com>
Thu, 23 May 2024 15:41:07 +0000 (09:41 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 14 Jun 2024 16:56:36 +0000 (10:56 -0600)
This moves search_symbol_list to symtab.c and exports it.  It will be
useful in a later patch.

gdb/cp-namespace.c
gdb/symtab.c
gdb/symtab.h

index 544ebcfddb78f8f29dac18ba9495084ffd27d618..e5ef54dd3cc85b24261d30567b873f73272f5e38 100644 (file)
@@ -539,23 +539,6 @@ cp_lookup_symbol_via_imports (const char *scope,
     return {};
 }
 
-/* Helper function that searches an array of symbols for one named NAME.  */
-
-static struct symbol *
-search_symbol_list (const char *name, int num,
-                   struct symbol **syms)
-{
-  int i;
-
-  /* Maybe we should store a dictionary in here instead.  */
-  for (i = 0; i < num; ++i)
-    {
-      if (strcmp (name, syms[i]->natural_name ()) == 0)
-       return syms[i];
-    }
-  return NULL;
-}
-
 /* Search for symbols whose name match NAME in the given SCOPE.
    if BLOCK is a function, we'll search first through the template
    parameters and function type. Afterwards (or if BLOCK is not a function)
index 5e65b893d6b7b665efa9025d852f30003e0cffbb..9aa7064009e5436af073b792254a1c0fde5338b3 100644 (file)
@@ -372,6 +372,19 @@ from_scripting_domain (int val)
 
 /* See symtab.h.  */
 
+struct symbol *
+search_symbol_list (const char *name, int num, struct symbol **syms)
+{
+  for (int i = 0; i < num; ++i)
+    {
+      if (strcmp (name, syms[i]->natural_name ()) == 0)
+       return syms[i];
+    }
+  return nullptr;
+}
+
+/* See symtab.h.  */
+
 CORE_ADDR
 linetable_entry::pc (const struct objfile *objfile) const
 {
index d5fe90a19d96045eaf4e8cc751d87fa7983658ac..3d766fd5685597d1dcfef0cbdaf5323d696f1e69 100644 (file)
@@ -2980,4 +2980,11 @@ extern void info_sources_worker (struct ui_out *uiout,
 
 std::optional<CORE_ADDR> find_epilogue_using_linetable (CORE_ADDR func_addr);
 
+/* Search an array of symbols for one named NAME.  Name comparison is
+   done using strcmp -- i.e., this is only useful for simple names.
+   Returns the symbol, if found, or nullptr if not.  */
+
+extern struct symbol *search_symbol_list (const char *name, int num,
+                                         struct symbol **syms);
+
 #endif /* !defined(SYMTAB_H) */