27 #include "opcode/rx.h"
120 static const char *
const reg_names[] = {
149 return reg_names[regnr];
230 CORE_ADDR after_last_frame_setup_insn = start_pc;
232 memset (result, 0,
sizeof (*result));
271 while (pc < limit_pc)
275 RX_Opcode_Decoded opc;
277 opcode_handle.
pc =
pc;
280 next_pc = pc + bytes_read;
282 if (opc.id == RXO_pushm
283 && opc.op[1].type == RX_Operand_Register
284 && opc.op[2].type == RX_Operand_Register)
291 for (r = r2; r >= r1; r--)
296 after_last_frame_setup_insn = next_pc;
298 else if (opc.id == RXO_mov
299 && opc.op[0].type == RX_Operand_Register
300 && opc.op[1].type == RX_Operand_Register
301 && opc.size == RX_Long)
305 rdst = opc.op[0].reg;
306 rsrc = opc.op[1].reg;
307 reg[rdst] = reg[rsrc];
309 after_last_frame_setup_insn = next_pc;
311 else if (opc.id == RXO_mov
312 && opc.op[0].type == RX_Operand_Predec
314 && opc.op[1].type == RX_Operand_Register
315 && opc.size == RX_Long)
319 rsrc = opc.op[1].
reg;
322 after_last_frame_setup_insn = next_pc;
324 else if (opc.id == RXO_add
325 && opc.op[0].type == RX_Operand_Register
326 && opc.op[1].type == RX_Operand_Immediate
327 && opc.op[2].type == RX_Operand_Register)
329 int rdst = opc.op[0].reg;
330 int addend = opc.op[1].addend;
331 int rsrc = opc.op[2].reg;
336 after_last_frame_setup_insn = next_pc;
338 else if (opc.id == RXO_mov
339 && opc.op[0].type == RX_Operand_Indirect
340 && opc.op[1].type == RX_Operand_Register
341 && opc.size == RX_Long
350 else if (opc.id == RXO_branch
351 && opc.op[0].type == RX_Operand_Immediate
352 && next_pc < opc.op[0].addend)
373 after_last_frame_setup_insn = opc.op[0].addend;
431 void **this_prologue_cache)
433 if (!*this_prologue_cache)
445 stop_addr = func_start;
448 *this_prologue_cache);
451 return *this_prologue_cache;
464 RX_Opcode_Decoded opc;
470 if (*this_cache != NULL)
490 opcode_handle.
pc = pc;
494 if (bytes_read <= 0 || opc.id == RXO_rts)
496 else if (opc.id == RXO_rtfi)
498 else if (opc.id == RXO_rte)
548 static struct value *
561 struct value *psw_val;
570 if ((psw & 0x20000 ) != 0)
629 if (*this_cache == NULL)
633 if (sniff_p (frame_type))
739 int num_register_candidate_args;
763 num_register_candidate_args =
TYPE_NFIELDS (func_type) - 1;
765 num_register_candidate_args = 4;
769 for (write_pass = 0; write_pass <= 1; write_pass++)
795 for (i = 0; i < nargs; i++)
797 struct value *arg = args[i];
802 if (i == 0 && struct_addr != 0 && !struct_return
805 byte_order) == struct_addr)
820 if (i < num_register_candidate_args
858 if (i < num_register_candidate_args
872 struct type *p_arg_type =
877 sp_off =
align_up (sp_off, p_arg_size);
881 p_arg_size, byte_order,
883 sp_off += p_arg_size;
893 if (i < num_register_candidate_args
896 && arg_size % 4 == 0)
898 int len =
min (arg_size, 4);
939 struct value *
function,
940 struct type *valtype,
959 while (valtype_len > 0)
961 int len =
min (valtype_len, 4);
977 while (valtype_len > 0)
979 int len =
min (valtype_len, 4);
997 *lenptr =
sizeof breakpoint;
1006 if (0 <= reg && reg <= 15)
1014 _(
"Undefined dwarf2 register mapping of reg %d"),
1019 static struct gdbarch *
1022 struct gdbarch *gdbarch;
1027 if (info.
abfd != NULL
1028 && bfd_get_flavour (info.
abfd) == bfd_target_elf_flavour)
1029 elf_flags = elf_elfheader (info.
abfd)->e_flags;
1116 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)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
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)
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
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)
struct type * arch_flags_type(struct gdbarch *gdbarch, char *name, int length)
static CORE_ADDR rx_unwind_sp(struct gdbarch *gdbarch, struct frame_info *this_frame)
static int rx_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int reg)
struct cleanup * make_cleanup_free_pv_area(struct pv_area *area)
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 internal_error(const char *file, int line, const char *fmt,...)
void append_flags_type_flag(struct type *type, int bitpos, char *name)
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))
enum prologue_value_kind kind
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)
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)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
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 * 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)
void initialize_file_ftype(void)
static int rx_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
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)
static const gdb_byte * rx_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
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 set_gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
void pv_area_store(struct pv_area *area, pv_t addr, CORE_ADDR size, pv_t value)
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 pv_area_scan(struct pv_area *area, void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
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]
struct pv_area * make_pv_area(int base_reg, int addr_bit)
int reg_offset[RX_NUM_REGS]
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
initialize_file_ftype _initialize_rx_tdep
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)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
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 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 do_cleanups(struct cleanup *old_chain)
void set_gdbarch_print_insn(struct gdbarch *gdbarch, gdbarch_print_insn_ftype print_insn)
const ULONGEST const LONGEST len
void set_gdbarch_vbit_in_delta(struct gdbarch *gdbarch, int vbit_in_delta)