#include "defs.h"
 #include "solib-aix.h"
+#include "solib.h"
 #include "solist.h"
 #include "inferior.h"
 #include "gdb_bfd.h"
 #include "gdbcmd.h"
 #include "gdbsupport/scope-exit.h"
 
-/* Variable controlling the output of the debugging traces for
-   this module.  */
-static bool solib_aix_debug;
-
-/* Print an "aix-solib" debug statement.  */
-
-#define solib_aix_debug_printf(fmt, ...) \
-  debug_prefixed_printf_cond (solib_aix_debug, "aix-solib",fmt, ##__VA_ARGS__)
-
 /* Our private data in struct so_list.  */
 
 struct lm_info_aix : public lm_info_base
       return data->library_list;
     }
 
-  solib_aix_debug_printf ("TARGET_OBJECT_LIBRARIES_AIX = %s",
-                         library_document->data ());
+  solib_debug_printf ("TARGET_OBJECT_LIBRARIES_AIX = %s",
+                     library_document->data ());
 
   data->library_list = solib_aix_parse_libraries (library_document->data ());
   if (!data->library_list.has_value () && warning_msg != NULL)
 {
   lm_info_aix *li = (lm_info_aix *) so->lm_info;
 
-  solib_aix_debug_printf ("%s", so->so_name);
+  solib_debug_printf ("%s", so->so_name);
 
   delete li;
 }
 
   result = data_osect->addr () + xcoff_get_toc_offset (pc_osect->objfile);
 
-  solib_aix_debug_printf ("pc=%s -> %s", core_addr_to_string (pc),
-                         core_addr_to_string (result));
+  solib_debug_printf ("pc=%s -> %s", core_addr_to_string (pc),
+                     core_addr_to_string (result));
 
   return result;
 }
   data->library_list.reset ();
 }
 
-/* Implements the "show debug aix-solib" command.  */
-
-static void
-show_solib_aix_debug (struct ui_file *file, int from_tty,
-                     struct cmd_list_element *c, const char *value)
-{
-  gdb_printf (file, _("solib-aix debugging is %s.\n"), value);
-}
-
 /* The target_so_ops for AIX targets.  */
 const struct target_so_ops solib_aix_so_ops =
 {
 {
   gdb::observers::normal_stop.attach (solib_aix_normal_stop_observer,
                                      "solib-aix");
-
-  /* Debug this file's internals.  */
-  add_setshow_boolean_cmd ("aix-solib", class_maintenance,
-                          &solib_aix_debug, _("\
-Control the debugging traces for the solib-aix module."), _("\
-Show whether solib-aix debugging traces are enabled."), _("\
-When on, solib-aix debugging traces are enabled."),
-                           NULL,
-                           show_solib_aix_debug,
-                           &setdebuglist, &showdebuglist);
 }
 
 #include "elf/frv.h"
 #include "gdb_bfd.h"
 
-/* Flag which indicates whether internal debug messages should be printed.  */
-static unsigned int solib_frv_debug;
-
 /* FR-V pointers are four bytes wide.  */
 enum { FRV_PTR_SIZE = 4 };
 
                                   current_program_space->symfile_object_file);
   if (got_sym.minsym == 0)
     {
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "lm_base: _GLOBAL_OFFSET_TABLE_ not found.\n");
+      solib_debug_printf ("_GLOBAL_OFFSET_TABLE_ not found.");
       return 0;
     }
 
   addr = got_sym.value_address () + 8;
 
-  if (solib_frv_debug)
-    gdb_printf (gdb_stdlog,
-               "lm_base: _GLOBAL_OFFSET_TABLE_ + 8 = %s\n",
-               hex_string_custom (addr, 8));
+  solib_debug_printf ("_GLOBAL_OFFSET_TABLE_ + 8 = %s",
+                     hex_string_custom (addr, 8));
 
   if (target_read_memory (addr, buf, sizeof buf) != 0)
     return 0;
   lm_base_cache = extract_unsigned_integer (buf, sizeof buf, byte_order);
 
-  if (solib_frv_debug)
-    gdb_printf (gdb_stdlog,
-               "lm_base: lm_base_cache = %s\n",
-               hex_string_custom (lm_base_cache, 8));
+  solib_debug_printf ("lm_base_cache = %s",
+                     hex_string_custom (lm_base_cache, 8));
 
   return lm_base_cache;
 }
       struct ext_link_map lm_buf;
       CORE_ADDR got_addr;
 
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "current_sos: reading link_map entry at %s\n",
-                   hex_string_custom (lm_addr, 8));
+      solib_debug_printf ("reading link_map entry at %s",
+                         hex_string_custom (lm_addr, 8));
 
       if (target_read_memory (lm_addr, (gdb_byte *) &lm_buf,
                              sizeof (lm_buf)) != 0)
          gdb::unique_xmalloc_ptr<char> name_buf
            = target_read_string (addr, SO_NAME_MAX_PATH_SIZE - 1);
 
-         if (solib_frv_debug)
-           gdb_printf (gdb_stdlog, "current_sos: name = %s\n",
-                       name_buf.get ());
-         
+         solib_debug_printf ("name = %s", name_buf.get ());
+
          if (name_buf == nullptr)
            warning (_("Can't read pathname for link map entry."));
          else
          return 0;
        }
 
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: interp_loadmap_addr = %s\n",
-                   hex_string_custom (interp_loadmap_addr, 8));
+      solib_debug_printf ("interp_loadmap_addr = %s",
+                         hex_string_custom (interp_loadmap_addr, 8));
 
       ldm = fetch_loadmap (interp_loadmap_addr);
       if (ldm == NULL)
          return 0;
        }
 
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: _dl_debug_addr "
-                   "(prior to relocation) = %s\n",
-                   hex_string_custom (addr, 8));
+      solib_debug_printf ("_dl_debug_addr (prior to relocation) = %s",
+                         hex_string_custom (addr, 8));
 
       addr += displacement_from_map (ldm, addr);
 
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: _dl_debug_addr "
-                   "(after relocation) = %s\n",
-                   hex_string_custom (addr, 8));
+      solib_debug_printf ("_dl_debug_addr (after relocation) = %s",
+                         hex_string_custom (addr, 8));
 
       /* Fetch the address of the r_debug struct.  */
       if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
        }
       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
 
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: _dl_debug_addr[0..3] = %s\n",
-                   hex_string_custom (addr, 8));
+      solib_debug_printf ("_dl_debug_addr[0..3] = %s",
+                         hex_string_custom (addr, 8));
 
       /* If it's zero, then the ldso hasn't initialized yet, and so
         there are no shared libs yet loaded.  */
       if (addr == 0)
        {
-         if (solib_frv_debug)
-           gdb_printf (gdb_stdlog,
-                       "enable_break: ldso not yet initialized\n");
+         solib_debug_printf ("ldso not yet initialized");
          /* Do not warn, but mark to run again.  */
          return 0;
        }
 
   if (current_program_space->symfile_object_file == NULL)
     {
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: No symbol file found.\n");
+      solib_debug_printf ("No symbol file found.");
       return 0;
     }
 
   if (!entry_point_address_query (&entry_point))
     {
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: Symbol file has no entry point.\n");
+      solib_debug_printf ("Symbol file has no entry point.");
       return 0;
     }
 
 
   if (interp_sect == NULL)
     {
-      if (solib_frv_debug)
-       gdb_printf (gdb_stdlog,
-                   "enable_break: No .interp section found.\n");
+      solib_debug_printf ("No .interp section found.");
       return 0;
     }
 
   create_solib_event_breakpoint (target_gdbarch (), entry_point);
 
-  if (solib_frv_debug)
-    gdb_printf (gdb_stdlog,
-               "enable_break: solib event breakpoint "
-               "placed at entry point: %s\n",
-               hex_string_custom (entry_point, 8));
+  solib_debug_printf ("solib event breakpoint placed at entry point: %s",
+                     hex_string_custom (entry_point, 8));
   return 1;
 }
 
   frv_in_dynsym_resolve_code,
   solib_bfd_open,
 };
-
-void _initialize_frv_solib ();
-void
-_initialize_frv_solib ()
-{
-  /* Debug this file's internals.  */
-  add_setshow_zuinteger_cmd ("solib-frv", class_maintenance,
-                            &solib_frv_debug, _("\
-Set internal debugging of shared library code for FR-V."), _("\
-Show internal debugging of shared library code for FR-V."), _("\
-When non-zero, FR-V solib specific internal debugging is enabled."),
-                            NULL,
-                            NULL, /* FIXME: i18n: */
-                            &setdebuglist, &showdebuglist);
-}