"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
- set_target_gdbarch (new_gdbarch);
+
+ current_inferior ()->set_arch (new_gdbarch);
return 1;
}
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
- set_target_gdbarch (gdbarch);
+
+ current_inferior ()->set_arch (gdbarch);
}
/* Initialize the current architecture. Update the ``set
return obstack_strdup (&arch->obstack, string);
}
-
/* Free a gdbarch struct. This should never happen in normal
operation --- once you've created a gdbarch, you keep it around.
However, if an architecture's init function encounters an error
return new_gdbarch;
}
-/* Make the specified architecture current. */
+/* See gdbarch.h. */
-void
-set_target_gdbarch (struct gdbarch *new_gdbarch)
+bool
+gdbarch_initialized_p (gdbarch *arch)
{
- gdb_assert (new_gdbarch != NULL);
- gdb_assert (new_gdbarch->initialized_p);
- current_inferior ()->set_arch (new_gdbarch);
- gdb::observers::architecture_changed.notify (current_inferior (),
- new_gdbarch);
- registers_changed ();
+ return arch->initialized_p;
}
/* Return the current inferior's arch. */
gdbarch_dump_tdep_ftype *dump_tdep = nullptr,
gdbarch_supports_arch_info_ftype *supports_arch_info = nullptr);
+/* Return true if ARCH is initialized. */
+
+bool gdbarch_initialized_p (gdbarch *arch);
/* Return a vector of the valid architecture names. Since architectures are
registered during the _initialize phase this function only returns useful
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-
-/* Helper function. Set the target gdbarch to "gdbarch". */
-
-extern void set_target_gdbarch (struct gdbarch *gdbarch);
-
-
/* A registry adaptor for gdbarch. This arranges to store the
registry in the gdbarch. */
template<>
set_args (construct_inferior_arguments (args));
}
+void
+inferior::set_arch (gdbarch *arch)
+{
+ gdb_assert (arch != nullptr);
+ gdb_assert (gdbarch_initialized_p (arch));
+ m_gdbarch = arch;
+ gdb::observers::architecture_changed.notify (this, arch);
+ registers_changed ();
+}
+
void
inferior::add_continuation (std::function<void ()> &&cont)
{