27 #include "opcode/rx.h" 121 static const char *
const reg_names[] = {
150 return reg_names[regnr];
288 CORE_ADDR after_last_frame_setup_insn = start_pc;
290 memset (result, 0,
sizeof (*result));
328 while (
pc < limit_pc)
332 RX_Opcode_Decoded opc;
334 opcode_handle.
pc =
pc;
337 next_pc =
pc + bytes_read;
339 if (opc.id == RXO_pushm
340 && opc.op[1].type == RX_Operand_Register
341 && opc.op[2].type == RX_Operand_Register)
348 for (r = r2; r >= r1; r--)
353 after_last_frame_setup_insn = next_pc;
355 else if (opc.id == RXO_mov
356 && opc.op[0].type == RX_Operand_Register
357 && opc.op[1].type == RX_Operand_Register
358 && opc.size == RX_Long)
362 rdst = opc.op[0].reg;
363 rsrc = opc.op[1].reg;
366 after_last_frame_setup_insn = next_pc;
368 else if (opc.id == RXO_mov
369 && opc.op[0].type == RX_Operand_Predec
371 && opc.op[1].type == RX_Operand_Register
372 && opc.size == RX_Long)
376 rsrc = opc.op[1].reg;
379 after_last_frame_setup_insn = next_pc;
381 else if (opc.id == RXO_add
382 && opc.op[0].type == RX_Operand_Register
383 && opc.op[1].type == RX_Operand_Immediate
384 && opc.op[2].type == RX_Operand_Register)
386 int rdst = opc.op[0].reg;
387 int addend = opc.op[1].addend;
388 int rsrc = opc.op[2].reg;
393 after_last_frame_setup_insn = next_pc;
395 else if (opc.id == RXO_mov
396 && opc.op[0].type == RX_Operand_Indirect
397 && opc.op[1].type == RX_Operand_Register
398 && opc.size == RX_Long
407 else if (opc.id == RXO_branch
408 && opc.op[0].type == RX_Operand_Immediate
409 && next_pc < opc.op[0].addend)
430 after_last_frame_setup_insn = opc.op[0].addend;
456 result->prologue_end = after_last_frame_setup_insn;
486 void **this_prologue_cache)
488 if (!*this_prologue_cache)
500 stop_addr = func_start;
506 return (
struct rx_prologue *) *this_prologue_cache;
519 RX_Opcode_Decoded opc;
525 if (*this_cache != NULL)
545 opcode_handle.
pc = pc;
549 if (bytes_read <= 0 || opc.id == RXO_rts)
551 else if (opc.id == RXO_rtfi)
553 else if (opc.id == RXO_rte)
603 static struct value *
616 struct value *psw_val;
625 if ((psw & 0x20000 ) != 0)
684 if (*this_cache == NULL)
794 int num_register_candidate_args;
820 num_register_candidate_args = 4;
824 for (write_pass = 0; write_pass <= 1; write_pass++)
850 for (i = 0; i < nargs; i++)
852 struct value *arg = args[i];
860 byte_order) == struct_addr)
876 if (i < num_register_candidate_args
914 if (i < num_register_candidate_args
928 struct type *p_arg_type =
933 sp_off =
align_up (sp_off, p_arg_size);
937 p_arg_size, byte_order,
939 sp_off += p_arg_size;
949 if (i < num_register_candidate_args
952 && arg_size % 4 == 0)
954 int len = std::min (arg_size, (
ULONGEST) 4);
995 struct value *
function,
996 struct type *valtype,
1015 while (valtype_len > 0)
1017 int len = std::min (valtype_len, (
ULONGEST) 4);
1033 while (valtype_len > 0)
1035 int len = std::min (valtype_len, (
ULONGEST) 4);
1057 if (0 <=
reg &&
reg <= 15)
1076 if (info.
abfd != NULL
1077 && bfd_get_flavour (info.
abfd) == bfd_target_elf_flavour)
1125 if (
elf_flags & E_FLAG_RX_64BIT_DOUBLES)
struct gdbarch * target_gdbarch(void)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
void set_gdbarch_float_format(struct gdbarch *gdbarch, const struct floatformat **float_format)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct type * builtin_func_ptr
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
CORE_ADDR get_frame_pc(struct frame_info *frame)
static struct value * rx_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
constexpr gdb_byte rx_break_insn[]
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
static const struct frame_unwind rx_exception_unwind
struct type * rx_psw_type
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
static const struct frame_unwind rx_frame_unwind
static CORE_ADDR rx_unwind_sp(struct gdbarch *gdbarch, struct frame_info *this_frame)
ULONGEST align_down(ULONGEST v, int n)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
static void rx_analyze_prologue(CORE_ADDR start_pc, CORE_ADDR limit_pc, enum rx_frame_type frame_type, struct rx_prologue *result)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
int pv_is_register(pv_t a, int r)
void * memset(T *s, int c, size_t n)=delete
static void rx_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
static int rx_frame_sniffer_common(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache, int(*sniff_p)(enum rx_frame_type))
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
struct gdbarch_list * next
static CORE_ADDR rx_frame_base(struct frame_info *this_frame, void **this_cache)
static struct type * rx_fpsw_type(struct gdbarch *gdbarch)
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
enum rx_frame_type frame_type
#define TYPE_PROTOTYPED(t)
#define TYPE_FIELD_TYPE(thistype, n)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
#define FRAME_OBSTACK_ZALLOC(TYPE)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
int target_read_code(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void check_for_saved(void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
static enum return_value_convention rx_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static struct type * rx_register_type(struct gdbarch *gdbarch, int reg_nr)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
struct type * arch_flags_type(struct gdbarch *gdbarch, const char *name, int bit)
struct type * check_typedef(struct type *type)
struct type * builtin_unsigned_long
static struct frame_id rx_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
static int rx_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
struct value::@186::@187 reg
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
const gdb_byte * value_contents_all(struct value *value)
static const char * rx_register_name(struct gdbarch *gdbarch, int regnr)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
static int normal_frame_p(enum rx_frame_type frame_type)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
void store(pv_t addr, CORE_ADDR size, pv_t value)
void scan(void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
void append_flags_type_flag(struct type *type, int bitpos, const char *name)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
int gdbarch_addr_bit(struct gdbarch *gdbarch)
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
static struct rx_prologue * rx_analyze_frame_prologue(struct frame_info *this_frame, enum rx_frame_type frame_type, void **this_prologue_cache)
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
struct type * builtin_unsigned_long_long
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
static CORE_ADDR rx_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
int reg_offset[RX_NUM_REGS]
static struct type * rx_psw_type(struct gdbarch *gdbarch)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
ULONGEST align_up(ULONGEST v, int n)
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
#define TYPE_TARGET_TYPE(thistype)
static struct gdbarch * rx_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
#define TYPE_CODE(thistype)
static CORE_ADDR rx_unwind_pc(struct gdbarch *gdbarch, struct frame_info *this_frame)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct value * frame_unwind_got_register(struct frame_info *frame, int regnum, int new_regnum)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
typedef BP_MANIPULATION(rx_break_insn)
struct type * rx_fpsw_type
static int rx_get_opcode_byte(void *handle)
#define TYPE_NFIELDS(thistype)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
static int rx_exception_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
void set_gdbarch_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
unsigned long long ULONGEST
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
static CORE_ADDR rx_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
int register_size(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
struct type * value_type(const struct value *value)
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
#define TYPE_LENGTH(thistype)
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
static int exception_frame_p(enum rx_frame_type frame_type)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
pv_t pv_register(int reg, CORE_ADDR k)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
void _initialize_rx_tdep(void)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
void set_gdbarch_vbit_in_delta(struct gdbarch *gdbarch, int vbit_in_delta)