gdb/tui: fairer distribution of excess space during apply
[binutils-gdb.git] / gdb / osabi.c
index 9d546a95954ca59a35aecbf73767e087ed1b3d5f..bbd7635532fb93111c1cebeac048e33ad184fe46 100644 (file)
@@ -1,6 +1,6 @@
 /* OS ABI variant handling for GDB.
 
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -77,7 +77,6 @@ static const struct osabi_names gdb_osabi_names[] =
   { "AIX", NULL },
   { "DICOS", NULL },
   { "Darwin", NULL },
-  { "Symbian", NULL },
   { "OpenVMS", NULL },
   { "LynxOS178", NULL },
   { "Newlib", NULL },
@@ -599,8 +598,6 @@ generic_elf_osabi_sniffer (bfd *abfd)
 static void
 set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  struct gdbarch_info info;
-
   if (strcmp (set_osabi_string, "auto") == 0)
     user_osabi_state = osabi_auto;
   else if (strcmp (set_osabi_string, "default") == 0)
@@ -631,7 +628,7 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
 
   /* NOTE: At some point (true multiple architectures) we'll need to be more
      graceful here.  */
-  gdbarch_info_init (&info);
+  gdbarch_info info;
   if (! gdbarch_update_p (info))
     internal_error (__FILE__, __LINE__, _("Updating OS ABI failed."));
 }
@@ -641,17 +638,17 @@ show_osabi (struct ui_file *file, int from_tty, struct cmd_list_element *c,
            const char *value)
 {
   if (user_osabi_state == osabi_auto)
-    fprintf_filtered (file,
-                     _("The current OS ABI is \"auto\" "
-                       "(currently \"%s\").\n"),
-                     gdbarch_osabi_name (gdbarch_osabi (get_current_arch ())));
+    gdb_printf (file,
+               _("The current OS ABI is \"auto\" "
+                 "(currently \"%s\").\n"),
+               gdbarch_osabi_name (gdbarch_osabi (get_current_arch ())));
   else
-    fprintf_filtered (file, _("The current OS ABI is \"%s\".\n"),
-                     gdbarch_osabi_name (user_selected_osabi));
+    gdb_printf (file, _("The current OS ABI is \"%s\".\n"),
+               gdbarch_osabi_name (user_selected_osabi));
 
   if (GDB_OSABI_DEFAULT != GDB_OSABI_UNKNOWN)
-    fprintf_filtered (file, _("The default OS ABI is \"%s\".\n"),
-                     gdbarch_osabi_name (GDB_OSABI_DEFAULT));
+    gdb_printf (file, _("The default OS ABI is \"%s\".\n"),
+               gdbarch_osabi_name (GDB_OSABI_DEFAULT));
 }
 
 void _initialize_gdb_osabi ();
@@ -669,11 +666,13 @@ _initialize_gdb_osabi ()
                                  generic_elf_osabi_sniffer);
 
   /* Register the "set osabi" command.  */
+  user_osabi_state = osabi_auto;
+  set_osabi_string = gdb_osabi_available_names[0];
+  gdb_assert (strcmp (set_osabi_string, "auto") == 0);
   add_setshow_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
                        &set_osabi_string,
                        _("Set OS ABI of target."),
                        _("Show OS ABI of target."),
                        NULL, set_osabi, show_osabi,
                        &setlist, &showlist);
-  user_osabi_state = osabi_auto;
 }