"and track explicitly loaded dynamic code."));
 }
 
-/* Helper function for gdb_bfd_lookup_symbol.  */
-
-static int
-cmp_name (const asymbol *sym, const void *data)
-{
-  return (strcmp (sym->name, (const char *) data) == 0);
-}
-
 /* The dynamic linkers has, as part of its debugger interface, support
    for arranging for the inferior to hit a breakpoint after mapping in
    the shared libraries.  This function enables that breakpoint.
            = info->interp_plt_sect_low + bfd_section_size (interp_sect);
        }
 
-      addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name,
-                                   "_dl_debug_state");
+      addr = (gdb_bfd_lookup_symbol
+             (tmp_bfd.get (),
+              [] (const asymbol *sym)
+              {
+                return strcmp (sym->name, "_dl_debug_state") == 0;
+              }));
+
       if (addr != 0)
        {
          if (solib_dsbt_debug)
 
           "and track explicitly loaded dynamic code."));
 }
 
-/* Helper function for gdb_bfd_lookup_symbol.  */
-
-static int
-cmp_name (const asymbol *sym, const void *data)
-{
-  return (strcmp (sym->name, (const char *) data) == 0);
-}
-
 /* Arrange for dynamic linker to hit breakpoint.
 
    The dynamic linkers has, as part of its debugger interface, support
            interp_plt_sect_low + bfd_section_size (interp_sect);
        }
 
-      addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_addr");
+      addr = (gdb_bfd_lookup_symbol
+             (tmp_bfd.get (),
+              [] (const asymbol *sym)
+              {
+                return strcmp (sym->name, "_dl_debug_addr") == 0;
+              }));
 
       if (addr == 0)
        {
 
     }
 }
 
-/* Helper function for gdb_bfd_lookup_symbol.  */
-
-static int
-cmp_name_and_sec_flags (const asymbol *sym, const void *data)
-{
-  return (strcmp (sym->name, (const char *) data) == 0
-         && (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0);
-}
 /* Arrange for dynamic linker to hit breakpoint.
 
    Both the SunOS and the SVR4 dynamic linkers have, as part of their
       /* Now try to set a breakpoint in the dynamic linker.  */
       for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
        {
-         sym_addr = gdb_bfd_lookup_symbol (tmp_bfd.get (),
-                                           cmp_name_and_sec_flags,
-                                           *bkpt_namep);
+         sym_addr
+           = (gdb_bfd_lookup_symbol
+              (tmp_bfd.get (),
+               [=] (const asymbol *sym)
+               {
+                 return (strcmp (sym->name, *bkpt_namep) == 0
+                         && ((sym->section->flags & (SEC_CODE | SEC_DATA))
+                             != 0));
+               }));
          if (sym_addr != 0)
            break;
        }
 
 /* Lookup the value for a specific symbol from dynamic symbol table.  Look
    up symbol from ABFD.  MATCH_SYM is a callback function to determine
    whether to pick up a symbol.  DATA is the input of this callback
-   function.  Return NULL if symbol is not found.  */
+   function.  Return 0 if symbol is not found.  */
 
 CORE_ADDR
-gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
-                                  int (*match_sym) (const asymbol *,
-                                                    const void *),
-                                  const void *data)
+gdb_bfd_lookup_symbol_from_symtab
+     (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
 {
   long storage_needed = bfd_get_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
        {
          asymbol *sym  = *symbol_table++;
 
-         if (match_sym (sym, data))
+         if (match_sym (sym))
            {
              struct gdbarch *gdbarch = target_gdbarch ();
              symaddr = sym->value;
 
 /* Lookup the value for a specific symbol from symbol table.  Look up symbol
    from ABFD.  MATCH_SYM is a callback function to determine whether to pick
-   up a symbol.  DATA is the input of this callback function.  Return NULL
+   up a symbol.  DATA is the input of this callback function.  Return 0
    if symbol is not found.  */
 
 static CORE_ADDR
-bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
-                                  int (*match_sym) (const asymbol *,
-                                                    const void *),
-                                  const void *data)
+bfd_lookup_symbol_from_dyn_symtab
+     (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
 {
   long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
        {
          asymbol *sym = *symbol_table++;
 
-         if (match_sym (sym, data))
+         if (match_sym (sym))
            {
              /* BFD symbols are section relative.  */
              symaddr = sym->value + sym->section->vma;
 /* Lookup the value for a specific symbol from symbol table and dynamic
    symbol table.  Look up symbol from ABFD.  MATCH_SYM is a callback
    function to determine whether to pick up a symbol.  DATA is the
-   input of this callback function.  Return NULL if symbol is not
+   input of this callback function.  Return 0 if symbol is not
    found.  */
 
 CORE_ADDR
-gdb_bfd_lookup_symbol (bfd *abfd,
-                      int (*match_sym) (const asymbol *, const void *),
-                      const void *data)
+gdb_bfd_lookup_symbol
+     (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
 {
-  CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym, data);
+  CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym);
 
   /* On FreeBSD, the dynamic linker is stripped by default.  So we'll
      have to check the dynamic string table too.  */
   if (symaddr == 0)
-    symaddr = bfd_lookup_symbol_from_dyn_symtab (abfd, match_sym, data);
+    symaddr = bfd_lookup_symbol_from_dyn_symtab (abfd, match_sym);
 
   return symaddr;
 }
 
 
 #include "gdb_bfd.h"
 #include "symfile-add-flags.h"
+#include "gdbsupport/function-view.h"
 
 /* Value of the 'set debug solib' configuration variable.  */
 
 
 /* Look up symbol from both symbol table and dynamic string table.  */
 
-extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
-                                       int (*match_sym) (const asymbol *,
-                                                         const void *),
-                                       const void *data);
+extern CORE_ADDR gdb_bfd_lookup_symbol
+     (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym);
 
 /* Look up symbol from symbol table.  */
 
-extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
-                                                   int (*match_sym)
-                                                     (const asymbol *,
-                                                      const void *),
-                                                   const void *data);
+extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab
+     (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym);
 
 /* Scan for DESIRED_DYNTAG in .dynamic section of ABFD.  If DESIRED_DYNTAG is
    found, 1 is returned and the corresponding PTR and PTR_ADDR are set.  */