+ info->byte_order_for_code = info->byte_order;
+}
+
+/* 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;
+ /* Wire the default to the last selected byte order. */
+ default_byte_order = info->byte_order;
+
+ /* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */
+ /* From the manual override, or from file. */
+ if (info->osabi == GDB_OSABI_UNKNOWN)
+ 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
+ /* If we still don't know which osabi to pick, pick none. */
+ if (info->osabi == GDB_OSABI_UNKNOWN)
+ info->osabi = GDB_OSABI_NONE;
+
+ /* 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,
+ std::string *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->clear ();
+ return 1;
+}
+
+const gdb_byte *
+default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+ int *lenptr)
+{
+ int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
+
+ return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
+}
+int
+default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR *pcptr)
+{
+ return gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
+}
+
+
+void
+default_gen_return_address (struct gdbarch *gdbarch,
+ struct agent_expr *ax, struct axs_value *value,
+ CORE_ADDR scope)
+{
+ error (_("This architecture has no method to collect a return address."));
+}
+
+int
+default_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
+ struct type *type)
+{
+ /* Usually, the return value's address is stored the in the "first hidden"
+ parameter if the return value should be passed by reference, as
+ specified in ABI. */
+ return language_pass_by_reference (type);
+}
+
+int default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ return 0;
+}
+
+int default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ return 0;
+}
+
+int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ return 0;
+}
+
+void
+default_skip_permanent_breakpoint (struct regcache *regcache)
+{
+ struct gdbarch *gdbarch = regcache->arch ();
+ CORE_ADDR current_pc = regcache_read_pc (regcache);
+ int bp_len;
+
+ gdbarch_breakpoint_from_pc (gdbarch, ¤t_pc, &bp_len);
+ current_pc += bp_len;
+ regcache_write_pc (regcache, current_pc);
+}
+
+CORE_ADDR
+default_infcall_mmap (CORE_ADDR size, unsigned prot)
+{
+ error (_("This target does not support inferior memory allocation by mmap."));
+}
+
+void
+default_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
+{
+ /* Memory reserved by inferior mmap is kept leaked. */
+}
+
+/* -mcmodel=large is used so that no GOT (Global Offset Table) is needed to be
+ created in inferior memory by GDB (normally it is set by ld.so). */
+
+std::string
+default_gcc_target_options (struct gdbarch *gdbarch)
+{
+ return string_printf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
+ (gdbarch_ptr_bit (gdbarch) == 64
+ ? " -mcmodel=large" : ""));
+}
+
+/* gdbarch gnu_triplet_regexp method. */
+
+const char *
+default_gnu_triplet_regexp (struct gdbarch *gdbarch)
+{
+ return gdbarch_bfd_arch_info (gdbarch)->arch_name;