+ struct gdbarch *gdbarch;
+ struct gdbarch_tdep *tdep;
+
+ /* If there is already a candidate, use it. */
+ arches = gdbarch_list_lookup_by_info (arches, &info);
+ if (arches != NULL)
+ return arches->gdbarch;
+
+ /* Allocate space for the new architecture. */
+ tdep = XMALLOC (struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
+
+ set_gdbarch_read_pc (gdbarch, m32r_read_pc);
+ set_gdbarch_write_pc (gdbarch, m32r_write_pc);
+ set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
+
+ set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
+ set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
+ set_gdbarch_register_name (gdbarch, m32r_register_name);
+ set_gdbarch_register_type (gdbarch, m32r_register_type);
+
+ set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call);
+ set_gdbarch_return_value (gdbarch, m32r_return_value);
+
+ set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue);
+ set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+ set_gdbarch_breakpoint_from_pc (gdbarch, m32r_breakpoint_from_pc);
+ set_gdbarch_memory_insert_breakpoint (gdbarch,
+ m32r_memory_insert_breakpoint);
+ set_gdbarch_memory_remove_breakpoint (gdbarch,
+ m32r_memory_remove_breakpoint);
+
+ set_gdbarch_frame_align (gdbarch, m32r_frame_align);
+
+ frame_base_set_default (gdbarch, &m32r_frame_base);
+
+ /* Methods for saving / extracting a dummy frame's ID. The ID's
+ stack address must match the SP value returned by
+ PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
+ set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
+
+ /* Return the unwound PC value. */
+ set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
+
+ set_gdbarch_print_insn (gdbarch, print_insn_m32r);
+
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
+
+ /* Hook in the default unwinders. */
+ frame_unwind_append_unwinder (gdbarch, &m32r_frame_unwind);
+
+ /* Support simple overlay manager. */
+ set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
+
+ return gdbarch;