52#define TIC6X_OPCODE_SIZE 4
53#define TIC6X_FETCH_PACKET_SIZE 32
55#define INST_S_BIT(INST) ((INST >> 1) & 1)
56#define INST_X_BIT(INST) ((INST >> 12) & 1)
85 "A0",
"A1",
"A2",
"A3",
86 "A4",
"A5",
"A6",
"A7",
87 "A8",
"A9",
"A10",
"A11",
88 "A12",
"A13",
"A14",
"A15",
89 "B0",
"B1",
"B2",
"B3",
90 "B4",
"B5",
"B6",
"B7",
91 "B8",
"B9",
"B10",
"B11",
92 "B12",
"B13",
"B14",
"B15",
98static const int arg_regs[] = { 4, 20, 6, 22, 8, 24, 10, 26, 12, 28 };
143 const CORE_ADDR current_pc,
147 unsigned int src_reg, base_reg, dst_reg;
149 CORE_ADDR pc = start_pc;
150 CORE_ADDR return_pc = start_pc;
151 int frame_base_offset_to_sp = 0;
153 int non_stw_insn_counter = 0;
155 if (start_pc >= current_pc)
156 return_pc = current_pc;
167 while (pc < current_pc)
171 if ((inst & 0x1ffc) == 0x1dc0 || (inst & 0x1ffc) == 0x1bc0
172 || (inst & 0x0ffc) == 0x9c0)
185 unsigned int ucst5 = (inst >> 13) & 0x1f;
187 if ((inst & 0x1ffc) == 0x1dc0)
188 frame_base_offset_to_sp += ucst5 << 2;
189 else if ((inst & 0x1ffc) == 0x1bc0)
190 frame_base_offset_to_sp += ucst5 << 1;
191 else if ((inst & 0x0ffc) == 0x9c0)
192 frame_base_offset_to_sp += ucst5;
194 gdb_assert_not_reached (
"unexpected instruction");
199 else if ((inst & 0x174) == 0x74)
210 cache->
reg_saved[src_reg] = ((inst >> 13) & 0x1f) << 2;
214 non_stw_insn_counter = 0;
218 non_stw_insn_counter++;
232 if (non_stw_insn_counter >= 2)
249 if ((inst & 0x164) == 0x64
274 cache->
cfa = cache->
base + frame_base_offset_to_sp;
300 CORE_ADDR post_prologue_pc
302 if (post_prologue_pc != 0)
303 return std::max (start_pc, post_prologue_pc);
322static const gdb_byte *
380 void **this_prologue_cache)
383 CORE_ADDR current_pc;
386 if (*this_prologue_cache)
390 (*this_prologue_cache) = cache;
414 if (cache->
base == 0)
497 if (*this_cache == NULL)
507 void **this_prologue_cache)
509 CORE_ADDR addr_in_block;
546 static const int register_numbers[8] = { -1, 16, 17, 18, 1, 2, 0, -1 };
548 register_number = register_numbers[(inst >> 29) & 7];
549 if (register_number == -1)
553 if ((inst & 0x10000000) != 0)
554 return register_value == 0;
555 return register_value != 0;
564 int r = (reg & 15) | ((crosspath ^ side) << 4);
573 int mask = (1 <<
bits) - 1;
574 int r = (
value >> low_bit) & mask;
575 if ((r & (1 << (
bits - 1))) != 0)
599 = gdbarch_tdep<tic6x_gdbarch_tdep> (
gdbarch);
607 if ((inst & 0x0000007c) == 0x00000010)
614 if ((inst & 0x0f83effc) == 0x00000360)
621 pc = regcache_raw_get_unsigned (
regcache, register_number);
624 if ((inst & 0x00001ffc) == 0x00001020)
636 if ((inst & 0x00001ffc) == 0x00000120)
643 if ((inst & 0x0f830ffe) == 0x00800362)
648 pc = regcache_raw_get_unsigned (
regcache, register_number);
651 if ((inst & 0x00001ffc) == 0x00000020)
663 if ((inst & 0xf000007c) == 0x10000010)
679static std::vector<CORE_ADDR>
692 return align_down (addr, 8);
700 enum bfd_endian byte_order, gdb_byte *valbuf)
702 int len = valtype->
length ();
714 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
726 if (byte_order == BFD_ENDIAN_BIG)
744 enum bfd_endian byte_order,
const gdb_byte *valbuf)
746 int len = valtype->
length ();
752 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
759 if (byte_order == BFD_ENDIAN_BIG)
777 gdb_byte *readbuf,
const gdb_byte *writebuf)
813 if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
827 gdb_assert_not_reached (
"unexpected length of data");
835 if (typecode == TYPE_CODE_COMPLEX)
842 if (typecode == TYPE_CODE_COMPLEX)
848 internal_error (_(
"unexpected length %d of type"),
858 int nargs,
struct value **args, CORE_ADDR sp,
860 CORE_ADDR struct_addr)
864 int stack_offset = 4;
865 int references_offset = 4;
870 int first_arg_on_stack = 10;
887 gdb_assert (
func_type->code () == TYPE_CODE_FUNC
888 ||
func_type->code () == TYPE_CODE_METHOD);
893 first_arg_on_stack =
func_type->num_fields () - 1;
896 for (argnum = 0; argnum < nargs; argnum++)
898 int len = align_up (args[argnum]->
type ()->
length (), 4);
899 if (argnum >= 10 - argreg)
900 references_offset += len;
906 sp = align_down (sp, 8);
912 for (argnum = 0; argnum < nargs; argnum++)
915 struct value *arg = args[argnum];
917 int len = arg_type->
length ();
924 if (argreg < first_arg_on_stack)
928 if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
938 if (len < 3 && byte_order == BFD_ENDIAN_BIG)
959 if (typecode == TYPE_CODE_STRUCT
960 || typecode == TYPE_CODE_UNION)
967 if (byte_order == BFD_ENDIAN_BIG)
1005 references_offset = align_up (references_offset, 8);
1007 addr = sp + references_offset;
1009 references_offset += align_up (len, 4);
1043 stack_offset = align_up (stack_offset,
1048 if (typecode == TYPE_CODE_COMPLEX)
1051 references_offset = align_up (references_offset, 8);
1053 addr = sp + references_offset;
1057 references_offset += align_up (len, 4);
1066 internal_error (_(
"unexpected type %d of arg %d"),
1070 internal_error (_(
"unexpected length %d of arg %d"), len, argnum);
1072 addr = sp + stack_offset;
1074 stack_offset += align_up (len, 4);
1091 if ((inst & 0x0f83effc) == 0x360)
1140 const struct target_desc *tdesc = info.target_desc;
1146 const struct tdesc_feature *feature;
1151 if (feature == NULL)
1157 for (i = 0; i < 32; i++)
1174 static const char *
const gp[] =
1176 "A16",
"A17",
"A18",
"A19",
"A20",
"A21",
"A22",
"A23",
1177 "A24",
"A25",
"A26",
"A27",
"A28",
"A29",
"A30",
"A31",
1178 "B16",
"B17",
"B18",
"B19",
"B20",
"B21",
"B22",
"B23",
1179 "B24",
"B25",
"B26",
"B27",
"B28",
"B29",
"B30",
"B31",
1184 for (j = 0; j < 32; j++)
1214 = gdbarch_tdep<tic6x_gdbarch_tdep> (
arches->gdbarch);
1216 if (has_gp != tdep->
has_gp)
#define bits(obj, st, fn)
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)
bool find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr, const struct block **block)
enum register_status cooked_read_part(int regnum, int offset, int len, gdb_byte *buf)
enum register_status cooked_read(int regnum, gdb_byte *buf)
void cooked_write(int regnum, const gdb_byte *buf)
void cooked_write_part(int regnum, int offset, int len, const gdb_byte *buf)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
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)
void dwarf2_frame_set_init_reg(struct gdbarch *gdbarch, void(*init_reg)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, frame_info_ptr))
@ DWARF2_FRAME_REG_SAME_VALUE
@ DWARF2_FRAME_REG_UNDEFINED
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
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)
void frame_unwind_register(frame_info_ptr next_frame, int regnum, gdb_byte *buf)
CORE_ADDR get_frame_func(frame_info_ptr this_frame)
frame_info_ptr get_current_frame(void)
CORE_ADDR get_frame_address_in_block(frame_info_ptr this_frame)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc)
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_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step)
void set_gdbarch_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align)
void set_gdbarch_get_longjmp_target(struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name)
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_return_in_first_hidden_param_p(struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p)
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than)
enum bfd_endian gdbarch_byte_order_for_code(struct gdbarch *gdbarch)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
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)
const struct target_desc * gdbarch_target_desc(struct gdbarch *gdbarch)
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
void set_gdbarch_stack_frame_destroyed_p(struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p)
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
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_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
void set_gdbarch_float_format(struct gdbarch *gdbarch, const struct floatformat **float_format)
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 floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
struct type * check_typedef(struct type *type)
const struct language_defn * current_language
struct language_pass_by_ref_info language_pass_by_reference(struct type *type)
static int in_plt_section(CORE_ADDR pc)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
LONGEST regcache_raw_get_signed(struct regcache *regcache, int regnum)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * builtin_func_ptr
struct type * builtin_uint32
enum dwarf2_frame_reg_rule how
enum language la_language
const gdb_byte * breakpoint
CORE_ADDR(* syscall_next_pc)(frame_info_ptr frame)
CORE_ADDR reg_saved[TIC6X_NUM_CORE_REGS]
gdb::array_view< const gdb_byte > contents()
struct type * type() const
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
tdesc_arch_data_up tdesc_data_alloc(void)
const struct tdesc_feature * tdesc_find_feature(const struct target_desc *target_desc, const char *name)
int tdesc_numbered_register(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *name)
static const registry< gdbarch >::key< tdesc_arch_data > tdesc_data
void tdesc_use_registers(struct gdbarch *gdbarch, const struct target_desc *target_desc, tdesc_arch_data_up &&early_data, tdesc_unknown_register_ftype unk_reg_cb)
int tdesc_has_registers(const struct target_desc *target_desc)
const char * tdesc_register_name(struct gdbarch *gdbarch, int regno)
std::unique_ptr< tdesc_arch_data, tdesc_arch_data_deleter > tdesc_arch_data_up
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static CORE_ADDR tic6x_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc)
static struct gdbarch * tic6x_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static void tic6x_stub_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static struct tic6x_unwind_cache * tic6x_frame_unwind_cache(frame_info_ptr this_frame, void **this_prologue_cache)
static CORE_ADDR tic6x_unwind_pc(struct gdbarch *gdbarch, frame_info_ptr next_frame)
void _initialize_tic6x_tdep()
static CORE_ADDR tic6x_push_dummy_call(struct gdbarch *gdbarch, struct value *function, 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 unsigned long tic6x_fetch_instruction(struct gdbarch *, CORE_ADDR)
const gdb_byte tic6x_bkpt_illegal_opcode_be[]
static int tic6x_return_in_first_hidden_param_p(struct gdbarch *gdbarch, struct type *type)
static const struct frame_base tic6x_frame_base
static const gdb_byte * tic6x_sw_breakpoint_from_kind(struct gdbarch *gdbarch, int kind, int *size)
static int tic6x_stub_unwind_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_prologue_cache)
static struct type * tic6x_register_type(struct gdbarch *gdbarch, int regno)
static const char * tic6x_register_name(struct gdbarch *gdbarch, int regno)
#define TIC6X_OPCODE_SIZE
static struct value * tic6x_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
static void tic6x_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static const struct frame_unwind tic6x_frame_unwind
static int tic6x_breakpoint_kind_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static CORE_ADDR tic6x_get_next_pc(struct regcache *regcache, CORE_ADDR pc)
static int tic6x_condition_true(struct regcache *regcache, unsigned long inst)
static struct tic6x_unwind_cache * tic6x_make_stub_cache(frame_info_ptr this_frame)
static void tic6x_extract_return_value(struct type *valtype, struct regcache *regcache, enum bfd_endian byte_order, gdb_byte *valbuf)
static CORE_ADDR tic6x_analyze_prologue(struct gdbarch *gdbarch, const CORE_ADDR start_pc, const CORE_ADDR current_pc, struct tic6x_unwind_cache *cache, frame_info_ptr this_frame)
static int tic6x_arg_type_alignment(struct type *type)
static const char *const tic6x_register_names[]
const gdb_byte tic6x_bkpt_illegal_opcode_le[]
static enum return_value_convention tic6x_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static CORE_ADDR tic6x_frame_align(struct gdbarch *gdbarch, CORE_ADDR addr)
static int tic6x_get_longjmp_target(frame_info_ptr frame, CORE_ADDR *pc)
static const struct frame_unwind tic6x_stub_unwind
static int tic6x_extract_signed_field(int value, int low_bit, int bits)
static int tic6x_stack_frame_destroyed_p(struct gdbarch *gdbarch, CORE_ADDR pc)
static void tic6x_store_return_value(struct type *valtype, struct regcache *regcache, enum bfd_endian byte_order, const gdb_byte *valbuf)
static void tic6x_setup_default(struct tic6x_unwind_cache *cache)
#define TIC6X_FETCH_PACKET_SIZE
static CORE_ADDR tic6x_frame_base_address(frame_info_ptr this_frame, void **this_cache)
static std::vector< CORE_ADDR > tic6x_software_single_step(struct regcache *regcache)
static const int arg_regs[]
static int tic6x_register_number(int reg, int side, int crosspath)
static void tic6x_dwarf2_frame_init_reg(struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, frame_info_ptr this_frame)