[2/2] gdb: pass inferior to gdbarch_update_p

Message ID 20240726162950.97023-2-simon.marchi@efficios.com
State New
Headers
Series [1/2] gdb: pass inferior to target_current_description |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Test failed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Test failed

Commit Message

Simon Marchi July 26, 2024, 4:29 p.m. UTC
  Make the current inferior reference bubble up one level.  I think this
makes it clearer what gdbarch_update_p, which is update the passed
inferior's architecture (although the function name could probably be
better).

When gdbarch_find_by_info, it is possible for the new architecture's
init callback to be called.  I have not audited all of them (there are
just too many), it's possible that some of them do care about the
current inferior, for some reason (for instance, if one of them makes a
target call).  If so, they should be changed too.

Change-Id: I89f012188d7fdca395a830f4b013743565f26847
---
 gdb/amd-dbgapi-target.c   |  2 +-
 gdb/arch-utils.c          | 80 +++++++++++++++++++++++----------------
 gdb/arm-tdep.c            |  2 +-
 gdb/cli/cli-setshow.c     | 20 ++++++----
 gdb/command.h             |  8 ++--
 gdb/cris-tdep.c           |  6 +--
 gdb/debuginfod-support.c  |  6 +--
 gdb/dwarf2/index-cache.c  |  2 +-
 gdb/gdbarch.h             |  4 +-
 gdb/guile/scm-param.c     | 20 +++++-----
 gdb/i386-darwin-nat.c     |  2 +-
 gdb/infcmd.c              |  6 +--
 gdb/language.c            |  2 +-
 gdb/mips-tdep.c           | 10 ++---
 gdb/osabi.c               |  3 +-
 gdb/rs6000-aix-nat.c      |  2 +-
 gdb/rs6000-tdep.c         |  4 +-
 gdb/target-descriptions.c |  4 +-
 gdb/target.c              |  4 +-
 19 files changed, 104 insertions(+), 83 deletions(-)
  

Comments

Simon Marchi July 29, 2024, 2:14 a.m. UTC | #1
On 2024-07-26 12:29, Simon Marchi wrote:
> Make the current inferior reference bubble up one level.  I think this
> makes it clearer what gdbarch_update_p, which is update the passed
> inferior's architecture (although the function name could probably be
> better).
> 
> When gdbarch_find_by_info, it is possible for the new architecture's
> init callback to be called.  I have not audited all of them (there are
> just too many), it's possible that some of them do care about the
> current inferior, for some reason (for instance, if one of them makes a
> target call).  If so, they should be changed too.

Please disregard this version, it looks like I mistakenly included some
changes from another WIP patch in this one.  I'll send a corrected
version shortly.

Simon
  

Patch

diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index 073270f0c217..f944b7921ad9 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -2170,7 +2170,7 @@  show_precise_memory_mode (struct ui_file *file, int from_tty,
 /* Callback for "set amdgpu precise-memory".  */
 
 static void
-set_precise_memory_mode (bool value)
+set_precise_memory_mode (bool value, int from_tty)
 {
   amd_dbgapi_inferior_info *info
     = get_amd_dbgapi_inferior_info (current_inferior ());
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 40710c13f8c8..d9e87dfcf090 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -366,7 +366,6 @@  static const char *const endian_enum[] =
   endian_auto,
   NULL,
 };
-static const char *set_endian_string = endian_auto;
 
 enum bfd_endian
 selected_byte_order (void)
@@ -374,52 +373,68 @@  selected_byte_order (void)
   return target_byte_order_user;
 }
 
+static const char *
+get_endian ()
+{
+  if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
+    {
+      if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
+	return endian_big;
+      else
+	return endian_little;
+    }
+  else if (target_byte_order_user == BFD_ENDIAN_BIG)
+    return endian_big;
+  else
+    return endian_little;
+}
+
 /* Called by ``show endian''.  */
 
 static void
-show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+show_endian (ui_file *file, int from_tty, cmd_list_element *cmd,
 	     const char *value)
 {
   if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
-    if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
-      gdb_printf (file, _("The target endianness is set automatically "
-			  "(currently big endian).\n"));
-    else
-      gdb_printf (file, _("The target endianness is set automatically "
-			  "(currently little endian).\n"));
+    {
+      if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
+	gdb_printf (_("The target endianness is set automatically "
+		      "(currently big endian).\n"));
+      else
+	gdb_printf (_("The target endianness is set automatically "
+		      "(currently little endian).\n"));
+    }
   else
     if (target_byte_order_user == BFD_ENDIAN_BIG)
-      gdb_printf (file,
-		  _("The target is set to big endian.\n"));
+      gdb_printf (_("The target is set to big endian.\n"));
     else
-      gdb_printf (file,
-		  _("The target is set to little endian.\n"));
+      gdb_printf (_("The target is set to little endian.\n"));
 }
 
 static void
-set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c)
+set_endian (const char *endian_string, int from_tty)
 {
   struct gdbarch_info info;
 
-  if (set_endian_string == endian_auto)
+  if (endian_string == endian_auto)
     {
       target_byte_order_user = BFD_ENDIAN_UNKNOWN;
-      if (! gdbarch_update_p (info))
+      if (! gdbarch_update_p (current_inferior (), info))
 	internal_error (_("set_endian: architecture update failed"));
     }
-  else if (set_endian_string == endian_little)
+  else if (endian_string == endian_little)
     {
       info.byte_order = BFD_ENDIAN_LITTLE;
-      if (! gdbarch_update_p (info))
+      if (! gdbarch_update_p (current_inferior (), info))
 	gdb_printf (gdb_stderr,
 		    _("Little endian target not supported by GDB\n"));
       else
 	target_byte_order_user = BFD_ENDIAN_LITTLE;
     }
-  else if (set_endian_string == endian_big)
+  else if (endian_string == endian_big)
     {
       info.byte_order = BFD_ENDIAN_BIG;
-      if (! gdbarch_update_p (info))
+      if (! gdbarch_update_p (current_inferior (), info))
 	gdb_printf (gdb_stderr,
 		    _("Big endian target not supported by GDB\n"));
       else
@@ -561,7 +576,7 @@  set_architecture (const char *ignore_args,
   if (strcmp (set_architecture_string, "auto") == 0)
     {
       target_architecture_user = NULL;
-      if (!gdbarch_update_p (info))
+      if (!gdbarch_update_p (current_inferior (), info))
 	internal_error (_("could not select an architecture automatically"));
     }
   else
@@ -569,7 +584,7 @@  set_architecture (const char *ignore_args,
       info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
       if (info.bfd_arch_info == NULL)
 	internal_error (_("set_architecture: bfd_scan_arch failed"));
-      if (gdbarch_update_p (info))
+      if (gdbarch_update_p (current_inferior (), info))
 	target_architecture_user = info.bfd_arch_info;
       else
 	gdb_printf (gdb_stderr,
@@ -579,22 +594,23 @@  set_architecture (const char *ignore_args,
   show_architecture (gdb_stdout, from_tty, NULL, NULL);
 }
 
-/* Try to select a global architecture that matches "info".  Return
-   non-zero if the attempt succeeds.  */
+/* See arch-utils.h.  */
+
 int
-gdbarch_update_p (struct gdbarch_info info)
+gdbarch_update_p (inferior *inf, struct gdbarch_info info)
 {
   struct gdbarch *new_gdbarch;
 
   /* Check for the current file.  */
   if (info.abfd == NULL)
-    info.abfd = current_program_space->exec_bfd ();
+    info.abfd = inf->pspace->exec_bfd ();
+
   if (info.abfd == NULL)
-    info.abfd = current_program_space->core_bfd ();
+    info.abfd = inf->pspace->core_bfd ();
 
   /* Check for the current target description.  */
   if (info.target_desc == NULL)
-    info.target_desc = target_current_description (current_inferior ());
+    info.target_desc = target_current_description (inf);
 
   new_gdbarch = gdbarch_find_by_info (info);
 
@@ -609,7 +625,7 @@  gdbarch_update_p (struct gdbarch_info info)
 
   /* If it is the same old architecture, accept the request (but don't
      swap anything).  */
-  if (new_gdbarch == current_inferior ()->arch ())
+  if (new_gdbarch == inf->arch ())
     {
       if (gdbarch_debug)
 	gdb_printf (gdb_stdlog, "gdbarch_update_p: "
@@ -626,7 +642,7 @@  gdbarch_update_p (struct gdbarch_info info)
 		host_address_to_string (new_gdbarch),
 		gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
 
-  current_inferior ()->set_arch (new_gdbarch);
+  inf->set_arch (new_gdbarch);
 
   return 1;
 }
@@ -751,7 +767,7 @@  initialize_current_architecture (void)
   info.byte_order = default_byte_order;
   info.byte_order_for_code = info.byte_order;
 
-  if (! gdbarch_update_p (info))
+  if (! gdbarch_update_p (current_inferior (), info))
     internal_error (_("initialize_current_architecture: Selection of "
 		      "initial architecture failed"));
 
@@ -1498,10 +1514,10 @@  void
 _initialize_gdbarch_utils ()
 {
   add_setshow_enum_cmd ("endian", class_support,
-			endian_enum, &set_endian_string, 
+			endian_enum, 
 			_("Set endianness of target."),
 			_("Show endianness of target."),
-			NULL, set_endian, show_endian,
+			nullptr, set_endian, get_endian, show_endian,
 			&setlist, &showlist);
   add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
 Set architecture debugging."), _("\
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f36ce631a08d..383abadcf29d 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9508,7 +9508,7 @@  arm_update_current_architecture (void)
 
   /* Update the architecture.  */
   gdbarch_info info;
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("could not update architecture"));
 }
 
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index bcc793b31480..2e96edaa028d 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -369,11 +369,11 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  }
 	newobj.shrink_to_fit ();
 
-	option_changed = c->var->set<std::string> (std::move (newobj));
+	option_changed = c->var->set<std::string> (std::move (newobj), from_tty);
       }
       break;
     case var_string_noescape:
-      option_changed = c->var->set<std::string> (std::string (arg));
+      option_changed = c->var->set<std::string> (std::string (arg), from_tty);
       break;
     case var_filename:
       if (*arg == '\0')
@@ -399,7 +399,7 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  val = xstrdup ("");
 
 	option_changed
-	  = c->var->set<std::string> (std::string (val));
+	  = c->var->set<std::string> (std::string (val), from_tty);
 	xfree (val);
       }
       break;
@@ -410,25 +410,29 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	if (val < 0)
 	  error (_("\"on\" or \"off\" expected."));
 
-	option_changed = c->var->set<bool> (val);
+	option_changed = c->var->set<bool> (val, from_tty);
       }
       break;
     case var_auto_boolean:
-      option_changed = c->var->set<enum auto_boolean> (parse_auto_binary_operation (arg));
+      option_changed
+	= c->var->set<enum auto_boolean> (parse_auto_binary_operation (arg),
+					  from_tty);
       break;
     case var_uinteger:
       option_changed
 	= c->var->set<unsigned int> (parse_cli_var_integer (c->var->type (),
 							    c->var->
 							    extra_literals (),
-							    &arg, true));
+							    &arg, true),
+				     from_tty);
       break;
     case var_integer:
     case var_pinteger:
       option_changed
 	= c->var->set<int> (parse_cli_var_integer (c->var->type (),
 						   c->var->extra_literals (),
-						   &arg, true));
+						   &arg, true),
+			    from_tty);
       break;
     case var_enum:
       {
@@ -440,7 +444,7 @@  do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	if (*after != '\0')
 	  error (_("Junk after item \"%.*s\": %s"), len, arg, after);
 
-	option_changed = c->var->set<const char *> (match);
+	option_changed = c->var->set<const char *> (match, from_tty);
       }
       break;
     default:
diff --git a/gdb/command.h b/gdb/command.h
index 0ceaf3e2a6dc..b739bf7cd557 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -191,7 +191,7 @@  template<typename T>
 struct setting_func_types_1<true, T>
 {
   using type = T;
-  using set = void (*) (type);
+  using set = void (*) (type, int);
   using get = type (*) ();
 };
 
@@ -199,7 +199,7 @@  template<typename T>
 struct setting_func_types_1<false, T>
 {
   using type = const T &;
-  using set = void (*) (type);
+  using set = void (*) (type, int);
   using get = type (*) ();
 };
 
@@ -338,7 +338,7 @@  struct setting
 
      The var_type of the setting must match T.  */
   template<typename T>
-  bool set (const T &v)
+  bool set (const T &v, int from_tty)
   {
     /* Check that the current instance is of one of the supported types for
        this instantiation.  */
@@ -350,7 +350,7 @@  struct setting
       {
 	gdb_assert (m_setter != nullptr);
 	auto setter = reinterpret_cast<typename setting_func_types<T>::set> (m_setter);
-	setter (v);
+	setter (v, from_tty);
       }
     else
       *static_cast<T *> (m_var) = v;
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 692aa9ac5477..769b93041652 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3883,7 +3883,7 @@  set_cris_version (const char *ignore_args, int from_tty,
   usr_cmd_cris_version_valid = 1;
   
   /* Update the current architecture, if needed.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("cris_gdbarch_update: failed to update architecture."));
 }
 
@@ -3894,7 +3894,7 @@  set_cris_mode (const char *ignore_args, int from_tty,
   struct gdbarch_info info;
 
   /* Update the current architecture, if needed.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error ("cris_gdbarch_update: failed to update architecture.");
 }
 
@@ -3905,7 +3905,7 @@  set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
   struct gdbarch_info info;
 
   /* Update the current architecture, if needed.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("cris_gdbarch_update: failed to update architecture."));
 }
 
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 841b6f2078c7..3d50154146d9 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -486,7 +486,7 @@  debuginfod_section_query (const unsigned char *build_id,
 /* Set callback for "set debuginfod enabled".  */
 
 static void
-set_debuginfod_enabled (const char *value)
+set_debuginfod_enabled (const char *value, int from_tty)
 {
 #if defined(HAVE_LIBDEBUGINFOD)
   debuginfod_enabled = value;
@@ -519,7 +519,7 @@  show_debuginfod_enabled (ui_file *file, int from_tty, cmd_list_element *cmd,
 /* Set callback for "set debuginfod urls".  */
 
 static void
-set_debuginfod_urls (const std::string &urls)
+set_debuginfod_urls (const std::string &urls, int from_tty)
 {
 #if defined(HAVE_LIBDEBUGINFOD)
   if (setenv (DEBUGINFOD_URLS_ENV_VAR, urls.c_str (), 1) != 0)
@@ -573,7 +573,7 @@  show_debuginfod_verbose_command (ui_file *file, int from_tty,
 /* Set callback for "maint set debuginfod download-sections".  */
 
 static void
-maint_set_debuginfod_download_sections (bool value)
+maint_set_debuginfod_download_sections (bool value, int from_tty)
 {
 #if !defined(HAVE_LIBDEBUGINFOD_FIND_SECTION)
   if (value)
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index c11b0164aa4e..4a99bb2b187b 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -292,7 +292,7 @@  show_index_cache_command (const char *arg, int from_tty)
 /* "set/show index-cache enabled" set callback.  */
 
 static void
-set_index_cache_enabled_command (bool value)
+set_index_cache_enabled_command (bool value, int from_tty)
 {
   if (value)
     global_index_cache.enable ();
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 5175ef79e5b8..0c81e9fff31a 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -316,7 +316,7 @@  extern obstack *gdbarch_obstack (gdbarch *arch);
 
 extern char *gdbarch_obstack_strdup (struct gdbarch *arch, const char *string);
 
-/* Helper function.  Force an update of the current architecture.
+/* Helper function.  Force an update of INF's architecture.
 
    The actual architecture selected is determined by INFO, ``(gdb) set
    architecture'' et.al., the existing architecture and BFD's default
@@ -325,7 +325,7 @@  extern char *gdbarch_obstack_strdup (struct gdbarch *arch, const char *string);
 
    Returns non-zero if the update succeeds.  */
 
-extern int gdbarch_update_p (struct gdbarch_info info);
+extern int gdbarch_update_p (inferior *inf, gdbarch_info info);
 
 
 /* Helper function.  Find an architecture matching info.
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 3a1e1583f540..d0581ae71870 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -504,7 +504,7 @@  add_setshow_generic (enum var_types param_type,
 
     case var_enum:
       /* Initialize the value, just in case.  */
-      make_setting (self).set<const char *> (self->enumeration[0]);
+      make_setting (self).set<const char *> (self->enumeration[0], 0);
       commands = add_setshow_enum_cmd (cmd_name, cmd_class, self->enumeration,
 				       &self->value.cstringval, set_doc,
 				       show_doc, help_doc, set_func, show_func,
@@ -726,7 +726,7 @@  pascm_set_param_value_x (param_smob *p_smob,
 		       value, arg_pos, func_name,
 		       _("string or #f for non-PARAM_FILENAME parameters"));
       if (gdbscm_is_false (value))
-	var.set<std::string> ("");
+	var.set<std::string> ("", 0);
       else
 	{
 	  SCM exception;
@@ -735,7 +735,7 @@  pascm_set_param_value_x (param_smob *p_smob,
 	    = gdbscm_scm_to_host_string (value, nullptr, &exception);
 	  if (string == nullptr)
 	    gdbscm_throw (exception);
-	  var.set<std::string> (string.release ());
+	  var.set<std::string> (string.release (), 0);
 	}
       break;
 
@@ -760,14 +760,14 @@  pascm_set_param_value_x (param_smob *p_smob,
 	    gdbscm_out_of_range_error (func_name, arg_pos, value,
 				       _("not member of enumeration"));
 	  }
-	var.set<const char *> (enumeration[i]);
+	var.set<const char *> (enumeration[i], 0);
 	break;
       }
 
     case var_boolean:
       SCM_ASSERT_TYPE (gdbscm_is_bool (value), value, arg_pos, func_name,
 		       _("boolean"));
-      var.set<bool> (gdbscm_is_true (value));
+      var.set<bool> (gdbscm_is_true (value), 0);
       break;
 
     case var_auto_boolean:
@@ -776,11 +776,11 @@  pascm_set_param_value_x (param_smob *p_smob,
 		       value, arg_pos, func_name,
 		       _("boolean or #:auto"));
       if (scm_is_eq (value, auto_keyword))
-	var.set<enum auto_boolean> (AUTO_BOOLEAN_AUTO);
+	var.set<enum auto_boolean> (AUTO_BOOLEAN_AUTO, 0);
       else if (gdbscm_is_true (value))
-	var.set<enum auto_boolean> (AUTO_BOOLEAN_TRUE);
+	var.set<enum auto_boolean> (AUTO_BOOLEAN_TRUE, 0);
       else
-	var.set<enum auto_boolean> (AUTO_BOOLEAN_FALSE);
+	var.set<enum auto_boolean> (AUTO_BOOLEAN_FALSE, 0);
       break;
 
     case var_integer:
@@ -862,9 +862,9 @@  pascm_set_param_value_x (param_smob *p_smob,
 				     _("integer out of range"));
 
 	if (var_type == var_uinteger)
-	  var.set<unsigned int> (static_cast<unsigned int> (val));
+	  var.set<unsigned int> (static_cast<unsigned int> (val), 0);
 	else
-	  var.set<int> (static_cast<int> (val));
+	  var.set<int> (static_cast<int> (val), 0);
 
 	break;
       }
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 59655996565c..55c6123bbcd7 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -499,7 +499,7 @@  darwin_check_osabi (darwin_inferior *inf, thread_t thread)
       else
 	info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386,
 					      bfd_mach_i386_i386);
-      gdbarch_update_p (info);
+      gdbarch_update_p (current_inferior (), info);
     }
 }
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index a030788331c3..d1824a26b9e2 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -91,7 +91,7 @@  static bool finish_print = true;
 /* Store the new value passed to 'set inferior-tty'.  */
 
 static void
-set_tty_value (const std::string &tty)
+set_tty_value (const std::string &tty, int from_tty)
 {
   current_inferior ()->set_tty (tty);
 }
@@ -122,7 +122,7 @@  show_inferior_tty_command (struct ui_file *file, int from_tty,
 /* Store the new value passed to 'set args'.  */
 
 static void
-set_args_value (const std::string &args)
+set_args_value (const std::string &args, int from_tty)
 {
   current_inferior ()->set_args (args);
 }
@@ -159,7 +159,7 @@  get_inferior_cwd ()
 /* Store the new value passed to 'set cwd'.  */
 
 static void
-set_cwd_value (const std::string &args)
+set_cwd_value (const std::string &args, int from_tty)
 {
   current_inferior ()->set_cwd (args);
 }
diff --git a/gdb/language.c b/gdb/language.c
index be6a1e89fd35..90d0d1588dfd 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -177,7 +177,7 @@  show_language_command (struct ui_file *file, int from_tty,
 /* Set callback for the "set/show language" setting.  */
 
 static void
-set_language (const char *language)
+set_language (const char *language, int from_tty)
 {
   enum language flang = language_unknown;
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index ae58d7c87206..b4a815658ffe 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -896,7 +896,7 @@  set_mips64_transfers_32bit_regs (const char *args, int from_tty,
   /* FIXME: cagney/2003-11-15: Should be setting a field in "info"
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     {
       mips64_transfers_32bit_regs_p = 0;
       error (_("32-bit compatibility mode not supported"));
@@ -6973,7 +6973,7 @@  set_mipsfpu_single_command (const char *args, int from_tty)
   /* FIXME: cagney/2003-11-15: Should be setting a field in "info"
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("set mipsfpu failed"));
 }
 
@@ -6986,7 +6986,7 @@  set_mipsfpu_double_command (const char *args, int from_tty)
   /* FIXME: cagney/2003-11-15: Should be setting a field in "info"
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("set mipsfpu failed"));
 }
 
@@ -6999,7 +6999,7 @@  set_mipsfpu_none_command (const char *args, int from_tty)
   /* FIXME: cagney/2003-11-15: Should be setting a field in "info"
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("set mipsfpu failed"));
 }
 
@@ -8846,7 +8846,7 @@  mips_abi_update (const char *ignore_args,
 
   /* Force the architecture to update, and (if it's a MIPS architecture)
      mips_gdbarch_init will take care of the rest.  */
-  gdbarch_update_p (info);
+  gdbarch_update_p (current_inferior (), info);
 }
 
 /* Print out which MIPS ABI is in use.  */
diff --git a/gdb/osabi.c b/gdb/osabi.c
index d494d8996234..dd9f4ef9ffef 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -25,6 +25,7 @@ 
 #include "gdb_bfd.h"
 
 #include "elf-bfd.h"
+#include "inferior.h"
 
 #ifndef GDB_OSABI_DEFAULT
 #define GDB_OSABI_DEFAULT GDB_OSABI_UNKNOWN
@@ -645,7 +646,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 info;
-  if (! gdbarch_update_p (info))
+  if (! gdbarch_update_p (current_inferior (), info))
     internal_error (_("Updating OS ABI failed."));
 }
 
diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index 908671a713a4..6a20f6124134 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -993,7 +993,7 @@  rs6000_nat_target::create_inferior (const char *exec_file,
   info.bfd_arch_info = bfd_get_arch_info (&abfd);
   info.abfd = current_program_space->exec_bfd ();
 
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("rs6000_create_inferior: failed "
 		      "to select architecture"));
 }
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 2edb8234e6b4..1cb9c720dd68 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -8604,7 +8604,7 @@  powerpc_set_soft_float (const char *args, int from_tty,
   struct gdbarch_info info;
 
   /* Update the architecture.  */
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("could not update architecture"));
 }
 
@@ -8630,7 +8630,7 @@  powerpc_set_vector_abi (const char *args, int from_tty,
 
   /* Update the architecture.  */
   gdbarch_info info;
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("could not update architecture"));
 }
 
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 23b5b109bb77..4bb48fc8bc1f 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -500,7 +500,7 @@  target_find_description (void)
       struct gdbarch_info info;
 
       info.target_desc = tdesc_info->tdesc;
-      if (!gdbarch_update_p (info))
+      if (!gdbarch_update_p (current_inferior (), info))
 	{
 	  warning (_("Architecture rejected target-supplied description"));
 	  tdesc_info->tdesc = nullptr;
@@ -537,7 +537,7 @@  target_clear_description (void)
   tdesc_info->tdesc = nullptr;
 
   gdbarch_info info;
-  if (!gdbarch_update_p (info))
+  if (!gdbarch_update_p (current_inferior (), info))
     internal_error (_("Could not remove target-supplied description"));
 }
 
diff --git a/gdb/target.c b/gdb/target.c
index a80b133a1b33..56543b5a6890 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4340,7 +4340,7 @@  target_supports_set_thread_options (gdb_thread_options options)
 bool target_async_permitted = true;
 
 static void
-set_maint_target_async (bool permitted)
+set_maint_target_async (bool permitted, int from_tty)
 {
   if (have_live_inferiors ())
     error (_("Cannot change this setting while the inferior is running."));
@@ -4411,7 +4411,7 @@  enum auto_boolean target_non_stop_enabled = AUTO_BOOLEAN_AUTO;
 /* Set callback for maint target-non-stop setting.  */
 
 static void
-set_maint_target_non_stop (auto_boolean enabled)
+set_maint_target_non_stop (auto_boolean enabled, int from_tty)
 {
   if (have_live_inferiors ())
     error (_("Cannot change this setting while the inferior is running."));