41#define MN10300_MAX_NUM_REGS 64
44#define MN10300_MAX_REGISTER_SIZE 64
102 case TYPE_CODE_RVALUE_REF:
105 case TYPE_CODE_COMPLEX:
108 case TYPE_CODE_STRUCT:
109 case TYPE_CODE_UNION:
113 while (align < falign)
118 case TYPE_CODE_ARRAY:
123 case TYPE_CODE_TYPEDEF:
127 internal_error (_(
"bad switch"));
142 case TYPE_CODE_STRUCT:
143 case TYPE_CODE_UNION:
159 case TYPE_CODE_ARRAY:
162 case TYPE_CODE_TYPEDEF:
186 else if (len <= 2 * regsz)
193 internal_error (_(
"Cannot store return value %d bytes long."), len);
214 memcpy (valbuf, buf, len);
216 else if (len <= 2 * regsz)
219 memcpy (valbuf, buf, regsz);
222 memcpy ((
char *) valbuf + regsz, buf, len - regsz);
225 internal_error (_(
"Cannot extract return value %d bytes long."), len);
237 gdb_byte *readbuf,
const gdb_byte *writebuf)
253 gdb_assert (reg < num_regs);
260 static const char *regs[] =
261 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
262 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
"",
263 "",
"",
"",
"",
"",
"",
"",
"",
264 "",
"",
"",
"",
"",
"",
"",
"fp"
273 static const char *regs[] =
274 {
"d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
275 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"",
276 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
277 "ssp",
"msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"",
"",
""
285 static const char *regs[] =
287 "d0",
"d1",
"d2",
"d3",
"a0",
"a1",
"a2",
"a3",
288 "sp",
"pc",
"mdr",
"psw",
"lir",
"lar",
"mdrq",
"r0",
289 "r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"ssp",
290 "msp",
"usp",
"mcrh",
"mcrl",
"mcvf",
"fpcr",
"",
"",
291 "fs0",
"fs1",
"fs2",
"fs3",
"fs4",
"fs5",
"fs6",
"fs7",
292 "fs8",
"fs9",
"fs10",
"fs11",
"fs12",
"fs13",
"fs14",
"fs15",
293 "fs16",
"fs17",
"fs18",
"fs19",
"fs20",
"fs21",
"fs22",
"fs23",
294 "fs24",
"fs25",
"fs26",
"fs27",
"fs28",
"fs29",
"fs30",
"fs31"
332 if (rreg > 7 && rreg < 12)
334 else if (rreg > 11 && rreg < 16)
363 CORE_ADDR start_pc, CORE_ADDR limit_pc,
370 CORE_ADDR after_last_frame_setup_insn = start_pc;
373 memset (result, 0,
sizeof (*result));
392 while (pc < limit_pc)
405 if (instr[0] == 0xcf)
409 save_mask = instr[1];
456 after_last_frame_setup_insn = pc;
459 else if ((instr[0] & 0xfc) == 0x3c)
461 int aN = instr[0] & 0x03;
467 after_last_frame_setup_insn = pc;
470 else if ((instr[0] & 0xf0) == 0x90
471 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
473 int aN = instr[0] & 0x03;
474 int aM = (instr[0] & 0x0c) >> 2;
481 else if ((instr[0] & 0xf0) == 0x80
482 && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
484 int dN = instr[0] & 0x03;
485 int dM = (instr[0] & 0x0c) >> 2;
492 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xd0)
494 int dN = instr[1] & 0x03;
495 int aM = (instr[1] & 0x0c) >> 2;
502 else if (instr[0] == 0xf1 && (instr[1] & 0xf0) == 0xe0)
504 int aN = instr[1] & 0x03;
505 int dM = (instr[1] & 0x0c) >> 2;
512 else if (instr[0] == 0xf8 && instr[1] == 0xfe)
527 after_last_frame_setup_insn = pc;
530 else if (instr[0] == 0xfa && instr[1] == 0xfe)
544 after_last_frame_setup_insn = pc;
547 else if (instr[0] == 0xfc && instr[1] == 0xfe)
562 after_last_frame_setup_insn = pc;
565 else if ((instr[0] & 0xfc) == 0x20)
570 aN = instr[0] & 0x03;
579 else if (instr[0] == 0xfa && (instr[1] & 0xfc) == 0xd0)
585 aN = instr[1] & 0x03;
600 else if (instr[0] == 0xfc && (instr[1] & 0xfc) == 0xd0)
606 aN = instr[1] & 0x03;
619 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x30)
624 Y = (instr[1] & 0x02) >> 1;
630 sM = (buf[0] & 0xf0) >> 4;
640 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x34)
645 Y = (instr[1] & 0x02) >> 1;
651 sM = (buf[0] & 0xf0) >> 4;
660 else if (instr[0] == 0xfb && instr[1] == 0x37)
662 int fsM, sM, Z, rN, rI;
670 rI = (buf[0] & 0xf0) >> 4;
672 sM = (buf[1] & 0xf0) >> 4;
673 Z = (buf[1] & 0x02) >> 1;
683 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x30)
689 Y = (instr[1] & 0x02) >> 1;
695 sM = (buf[0] & 0xf0) >> 4;
706 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x30)
712 Y = (instr[1] & 0x02) >> 1;
718 sM = (buf[0] & 0xf0) >> 4;
729 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x30)
735 Y = (instr[1] & 0x02) >> 1;
741 sM = (buf[0] & 0xf0) >> 4;
752 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x34)
758 Y = (instr[1] & 0x02) >> 1;
764 sM = (buf[0] & 0xf0) >> 4;
774 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x34)
780 Y = (instr[1] & 0x02) >> 1;
786 sM = (buf[0] & 0xf0) >> 4;
796 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x34)
802 Y = (instr[1] & 0x02) >> 1;
808 sM = (buf[0] & 0xf0) >> 4;
818 else if (instr[0] == 0xf9 && (instr[1] & 0xfd) == 0x31)
820 int fsM, sM, Y, rN, rN_regnum;
823 Y = (instr[1] & 0x02) >> 1;
829 sM = (buf[0] & 0xf0) >> 4;
835 stack.
store (regs[rN_regnum], 4,
842 else if (instr[0] == 0xfb && (instr[1] & 0xfd) == 0x31)
844 int fsM, sM, Y, rN, rN_regnum;
848 Y = (instr[1] & 0x02) >> 1;
854 sM = (buf[0] & 0xf0) >> 4;
867 else if (instr[0] == 0xfd && (instr[1] & 0xfd) == 0x31)
869 int fsM, sM, Y, rN, rN_regnum;
873 Y = (instr[1] & 0x02) >> 1;
879 sM = (buf[0] & 0xf0) >> 4;
892 else if (instr[0] == 0xfe && (instr[1] & 0xfd) == 0x31)
894 int fsM, sM, Y, rN, rN_regnum;
898 Y = (instr[1] & 0x02) >> 1;
904 sM = (buf[0] & 0xf0) >> 4;
917 else if ((instr[0] & 0xf0) == 0x90)
919 int aN = instr[0] & 0x03;
928 else if ((instr[0] & 0xfc) == 0x24)
930 int aN = instr[0] & 0x03;
943 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xdc))
945 int aN = instr[1] & 0x03;
958 else if ((instr[0] & 0xf0) == 0x80)
960 int dN = instr[0] & 0x03;
969 else if ((instr[0] & 0xfc) == 0x2c)
971 int dN = instr[0] & 0x03;
984 else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xcc))
986 int dN = instr[1] & 0x03;
1030 CORE_ADDR func_addr, func_end;
1046 void **this_prologue_cache)
1048 if (!*this_prologue_cache)
1050 CORE_ADDR func_start, stop_addr;
1060 stop_addr = func_start;
1063 func_start, stop_addr,
1065 *this_prologue_cache));
1099 void **this_prologue_cache,
1103 this_prologue_cache),
1108static struct value *
1110 void **this_prologue_cache,
int regnum)
1156 struct value *target_func,
1159 int nargs,
struct value **args,
1162 CORE_ADDR struct_addr)
1168 int stack_offset = 0;
1170 const gdb_byte *val;
1182 for (len = 0, argnum = 0; argnum < nargs; argnum++)
1184 arg_len = (args[argnum]->type ()->length () + 3) & ~3;
1185 while (regs_used < 2 && arg_len > 0)
1188 arg_len -= push_size;
1205 for (argnum = 0; argnum < nargs; argnum++)
1208 if ((*args)->type ()->code () == TYPE_CODE_STRUCT
1209 && (*args)->type ()->length () > 8)
1212 arg_len = push_size;
1215 (*args)->address ());
1220 arg_len = (*args)->type ()->length ();
1221 val = (*args)->contents ().data ();
1224 while (regs_used < 2 && arg_len > 0)
1229 arg_len -= push_size;
1236 arg_len -= push_size;
1238 stack_offset += push_size;
1277 CORE_ADDR unwound_sp
1279 if (sp != unwound_sp)
1281 sp - (unwound_sp - sp));
1301 static int dwarf2_to_gdb[] = {
1325 || dwarf2 >= ARRAY_SIZE (dwarf2_to_gdb))
1328 return dwarf2_to_gdb[dwarf2];
1345 switch (
info.bfd_arch_info->mach)
1348 case bfd_mach_mn10300:
1358 case bfd_mach_am33_2:
1365 internal_error (_(
"mn10300_gdbarch_init: Unknown mn10300 variant"));
1384 mn10300_breakpoint::kind_from_pc);
1386 mn10300_breakpoint::bp_from_kind);
1411 gdb_printf (file,
"mn10300_dump_tdep: am33_mode = %d\n",
void gdbarch_register(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep, gdbarch_supports_arch_info_ftype *supports_arch_info)
static std::vector< const char * > arches
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
#define BP_MANIPULATION(BREAK_INSN)
bool find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr, const struct block **block)
void scan(void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
void store(pv_t addr, CORE_ADDR size, pv_t value)
enum register_status raw_read(int regnum, gdb_byte *buf)
void raw_write_part(int regnum, int offset, int len, const gdb_byte *buf)
void raw_write(int regnum, const gdb_byte *buf)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
@ RETURN_VALUE_REGISTER_CONVENTION
@ RETURN_VALUE_STRUCT_CONVENTION
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
int default_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_prologue_cache)
struct value * frame_unwind_got_memory(frame_info_ptr frame, int regnum, CORE_ADDR addr)
struct value * frame_unwind_got_register(frame_info_ptr frame, int regnum, int new_regnum)
enum unwind_stop_reason default_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
struct value * frame_unwind_got_constant(frame_info_ptr frame, int regnum, ULONGEST val)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
CORE_ADDR get_frame_func(frame_info_ptr this_frame)
static frame_info_ptr create_new_frame(frame_id id)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue)
CORE_ADDR gdbarch_unwind_sp(struct gdbarch *gdbarch, frame_info_ptr next_frame)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_fp0_regnum(struct gdbarch *gdbarch, int fp0_regnum)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type)
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, gdbarch_tdep_up tdep)
std::unique_ptr< gdbarch_tdep_base > gdbarch_tdep_up
function_call_return_method
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * check_typedef(struct type *type)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type, struct type **function_type)
static struct mn10300_prologue * mn10300_analyze_frame_prologue(frame_info_ptr this_frame, void **this_prologue_cache)
static CORE_ADDR mn10300_frame_base(frame_info_ptr this_frame, void **this_prologue_cache)
static int mn10300_type_align(struct type *type)
static struct gdbarch * mn10300_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static CORE_ADDR mn10300_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
static void check_for_saved(void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
static void mn10300_frame_this_id(frame_info_ptr this_frame, void **this_prologue_cache, struct frame_id *this_id)
static CORE_ADDR mn10300_push_dummy_call(struct gdbarch *gdbarch, struct value *target_func, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr)
static void mn10300_frame_unwind_init(struct gdbarch *gdbarch)
static void mn10300_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc, CORE_ADDR limit_pc, struct mn10300_prologue *result)
static const char * mn10300_generic_register_name(struct gdbarch *gdbarch, int reg)
static int mn10300_use_struct_convention(struct type *type)
static void mn10300_extract_return_value(struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf)
#define MN10300_MAX_REGISTER_SIZE
static const char * am33_register_name(struct gdbarch *gdbarch, int reg)
static const char * register_name(int reg, const char **regs, long num_regs)
constexpr gdb_byte mn10300_break_insn[]
static struct type * mn10300_register_type(struct gdbarch *gdbarch, int reg)
static struct value * mn10300_frame_prev_register(frame_info_ptr this_frame, void **this_prologue_cache, int regnum)
#define MN10300_MAX_NUM_REGS
static const struct frame_unwind mn10300_frame_unwind
static void mn10300_store_return_value(struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static void mn10300_dump_tdep(struct gdbarch *gdbarch, struct ui_file *file)
void _initialize_mn10300_tdep()
static const char * am33_2_register_name(struct gdbarch *gdbarch, int reg)
static int mn10300_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, int dwarf2)
static enum return_value_convention mn10300_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static int translate_rreg(int rreg)
static int get_am33_mode(gdbarch *arch)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
pv_t pv_constant(CORE_ADDR k)
pv_t pv_register(int reg, CORE_ADDR k)
pv_t pv_add(pv_t a, pv_t b)
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
int pv_is_register(pv_t a, int r)
int register_size(struct gdbarch *gdbarch, int regnum)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * builtin_int
struct type * type() const
int reg_offset[MN10300_MAX_NUM_REGS]
struct field & field(int idx) const
unsigned int num_fields() const
struct value::@203::@204 reg
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void gdb_printf(struct ui_file *stream, const char *format,...)