+/* Similar to init, but this time fill in the blanks. Information is
+ obtained from the global "set ..." options and explicitly
+ initialized INFO fields. */
+
+void
+gdbarch_info_fill (struct gdbarch_info *info)
+{
+ /* "(gdb) set architecture ...". */
+ if (info->bfd_arch_info == NULL
+ && target_architecture_user)
+ info->bfd_arch_info = target_architecture_user;
+ /* From the file. */
+ if (info->bfd_arch_info == NULL
+ && info->abfd != NULL
+ && bfd_get_arch (info->abfd) != bfd_arch_unknown
+ && bfd_get_arch (info->abfd) != bfd_arch_obscure)
+ info->bfd_arch_info = bfd_get_arch_info (info->abfd);
+ /* From the target. */
+ if (info->target_desc != NULL)
+ info->bfd_arch_info = choose_architecture_for_target
+ (info->target_desc, info->bfd_arch_info);
+ /* From the default. */
+ if (info->bfd_arch_info == NULL)
+ info->bfd_arch_info = default_bfd_arch;
+
+ /* "(gdb) set byte-order ...". */
+ if (info->byte_order == BFD_ENDIAN_UNKNOWN
+ && target_byte_order_user != BFD_ENDIAN_UNKNOWN)
+ info->byte_order = target_byte_order_user;
+ /* From the INFO struct. */
+ if (info->byte_order == BFD_ENDIAN_UNKNOWN
+ && info->abfd != NULL)
+ info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG
+ : bfd_little_endian (info->abfd) ? BFD_ENDIAN_LITTLE
+ : BFD_ENDIAN_UNKNOWN);
+ /* From the default. */
+ if (info->byte_order == BFD_ENDIAN_UNKNOWN)
+ info->byte_order = default_byte_order;
+ info->byte_order_for_code = info->byte_order;
+
+ /* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */
+ /* From the manual override, or from file. */
+ if (info->osabi == GDB_OSABI_UNINITIALIZED)
+ info->osabi = gdbarch_lookup_osabi (info->abfd);
+ /* From the target. */
+ if (info->osabi == GDB_OSABI_UNKNOWN && info->target_desc != NULL)
+ info->osabi = tdesc_osabi (info->target_desc);
+ /* From the configured default. */
+#ifdef GDB_OSABI_DEFAULT
+ if (info->osabi == GDB_OSABI_UNKNOWN)
+ info->osabi = GDB_OSABI_DEFAULT;
+#endif
+
+ /* Must have at least filled in the architecture. */
+ gdb_assert (info->bfd_arch_info != NULL);
+}
+
+/* Return "current" architecture. If the target is running, this is the
+ architecture of the selected frame. Otherwise, the "current" architecture
+ defaults to the target architecture.
+
+ This function should normally be called solely by the command interpreter
+ routines to determine the architecture to execute a command in. */
+struct gdbarch *
+get_current_arch (void)
+{
+ if (has_stack_frames ())
+ return get_frame_arch (get_selected_frame (NULL));
+ else
+ return target_gdbarch;
+}
+
+int
+default_has_shared_address_space (struct gdbarch *gdbarch)
+{
+ /* Simply say no. In most unix-like targets each inferior/process
+ has its own address space. */
+ return 0;
+}
+
+int
+default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
+ CORE_ADDR addr, int *isize, char **msg)
+{
+ /* We don't know if maybe the target has some way to do fast
+ tracepoints that doesn't need gdbarch, so always say yes. */
+ if (msg)
+ *msg = NULL;
+ return 1;
+}
+
+void
+default_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+ int *kindptr)
+{
+ gdbarch_breakpoint_from_pc (gdbarch, pcptr, kindptr);
+}
+