@@ -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 ());
@@ -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."), _("\
@@ -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"));
}
@@ -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:
@@ -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;
@@ -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."));
}
@@ -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)
@@ -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 ();
@@ -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.
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
@@ -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;
@@ -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. */
@@ -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."));
}
@@ -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"));
}
@@ -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"));
}
@@ -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"));
}
@@ -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."));