+ info->osabi = GDB_OSABI_UNINITIALIZED;
+}
+
+/* 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)
+{
+ /* Check for the current file. */
+ if (info->abfd == NULL)
+ info->abfd = exec_bfd;
+
+ /* Check for the current target description. */
+ if (info->target_desc == NULL)
+ info->target_desc = target_current_description ();
+
+ /* "(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->bfd_arch_info, tdesc_architecture (info->target_desc));
+ /* 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;
+
+ /* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */
+ if (info->osabi == GDB_OSABI_UNINITIALIZED)
+ info->osabi = gdbarch_lookup_osabi (info->abfd);
+
+ /* Must have at least filled in the architecture. */
+ gdb_assert (info->bfd_arch_info != NULL);