79 #define AVR_TYPE_ADDRESS_CLASS_FLASH TYPE_ADDRESS_CLASS_1 80 #define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH \ 81 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 148 AVR_EMEM_START = 0x00810000,
210 static const char *
const register_names[] = {
211 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
212 "r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15",
213 "r16",
"r17",
"r18",
"r19",
"r20",
"r21",
"r22",
"r23",
214 "r24",
"r25",
"r26",
"r27",
"r28",
"r29",
"r30",
"r31",
220 if (
regnum >= (
sizeof (register_names) /
sizeof (*register_names)))
222 return register_names[
regnum];
256 return ((x) & 0xffffffff);
274 return ((x) & 0xffffffff);
531 len = pc_end - pc_beg;
550 static const unsigned char img[] = {
557 if ((insn & 0xf0f0) == 0xe0c0)
559 locals = (insn & 0xf) | ((insn & 0x0f00) >> 4);
562 if ((insn & 0xf0f0) == 0xe0d0)
564 locals |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
565 if (vpc + 4 +
sizeof (img) < len
566 && memcmp (prologue + vpc + 4, img,
sizeof (img)) == 0)
593 if ((insn & 0xf0f0) != 0xe0a0)
595 loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4);
600 if ((insn & 0xf0f0) != 0xe0b0)
602 loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
607 if ((insn & 0xf0f0) != 0xe0e0)
609 body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4);
614 if ((insn & 0xf0f0) != 0xe0f0)
616 body_addr |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
625 if ((insn & 0xf000) == 0xc000)
628 i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
634 if (body_addr != (pc_beg + 10)/2)
639 else if ((insn & 0xfe0e) == 0x940c)
642 i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
648 if (body_addr != (pc_beg + 12)/2)
680 info->
size = loc_size + num_pushes;
683 return pc_beg + pc_offset;
693 static const unsigned char img[] = {
701 if (len >=
sizeof (img)
702 && memcmp (prologue, img,
sizeof (img)) == 0)
711 else if (len >=
sizeof (img) - 2
712 && memcmp (img + 2, prologue,
sizeof (img) - 2) == 0)
715 vpc +=
sizeof (img) - 2;
726 for (; vpc < len; vpc += 2)
729 if ((insn & 0xfe0f) == 0x920f)
732 int regno = (insn & 0x1f0) >> 4;
745 while (scan_stage == 1 && vpc < len)
753 else if (insn == 0x920f || insn == 0x921f)
767 if (scan_stage == 1 && vpc < len)
769 static const unsigned char img[] = {
774 if (vpc +
sizeof (img) < len
775 && memcmp (prologue + vpc, img,
sizeof (img)) == 0)
792 if (scan_stage == 2 && vpc < len)
795 static const unsigned char img[] = {
802 static const unsigned char img_sig[] = {
806 static const unsigned char img_int[] = {
814 if ((insn & 0xff30) == 0x9720)
816 locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
819 else if ((insn & 0xf0f0) == 0x50c0)
821 locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
825 locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4)) << 8;
834 if (vpc +
sizeof (img_sig) < len
835 && memcmp (prologue + vpc, img_sig,
sizeof (img_sig)) == 0)
837 vpc +=
sizeof (img_sig);
839 else if (vpc +
sizeof (img_int) < len
840 && memcmp (prologue + vpc, img_int,
sizeof (img_int)) == 0)
842 vpc +=
sizeof (img_int);
844 if (vpc +
sizeof (img) < len
845 && memcmp (prologue + vpc, img,
sizeof (img)) == 0)
851 info->
size += locals_size;
859 for (; vpc < len; vpc += 2)
862 if ((insn & 0xff00) == 0x0100)
864 else if ((insn & 0xfc00) == 0x2c00)
885 if (post_prologue_pc != 0)
886 return std::max (pc, post_prologue_pc);
952 if (writebuf != NULL)
976 void **this_prologue_cache)
986 if (*this_prologue_cache)
990 *this_prologue_cache = info;
998 if ((start_pc > 0) && (start_pc <= current_pc))
1000 start_pc, current_pc, info);
1012 this_base += (high_base << 8);
1016 prev_sp = this_base + info->
size;
1023 prev_sp = this_base + info->
size;
1079 void **this_prologue_cache,
1102 static struct value *
1104 void **this_prologue_cache,
int regnum)
1137 pc = (
pc << 8) | buf[i];
1207 memcpy (si->
data, contents,
len);
1282 if (sp == struct_addr)
1286 for (i = 0; i < nargs; i++)
1290 struct value *arg = args[i];
1298 last_regnum =
regnum - (len + (len & 1)) + 1;
1310 for (j = 0; j < len; j++)
1334 for (i = 1; i <= call_length; i++)
1336 buf[call_length - i] = return_pc & 0xff;
1350 return sp + call_length;
1358 if (
reg >= 0 &&
reg < 32)
1377 if (dwarf2_addr_class == 1 && byte_size == 2)
1402 int *type_flags_ptr)
1404 if (strcmp (
name,
"flash") == 0)
1427 case bfd_mach_avrxmega1:
1429 case bfd_mach_avrxmega2:
1431 case bfd_mach_avrxmega3:
1433 case bfd_mach_avrxmega4:
1435 case bfd_mach_avrxmega5:
1440 case bfd_mach_avrxmega6:
1441 case bfd_mach_avrxmega7:
1556 unsigned int nreg = 0;
1562 "avr.io_reg", &buf);
1563 bufstr = (
const char *) buf;
1568 _(
"ERR: info io_registers NOT supported " 1569 "by current target\n"));
1573 if (sscanf (bufstr,
"%x", &nreg) != 1)
1576 _(
"Error fetching number of io registers\n"));
1590 for (i = 0; i < nreg; i += step)
1597 snprintf (
query,
sizeof (
query) - 1,
"avr.io_reg:%x,%x", i, j);
1601 p = (
const char *) buf;
1602 for (k = i; k < (i + j); k++)
1604 if (sscanf (p,
"%[^,],%x;",
query, &val) == 2)
1607 while ((*p !=
';') && (*p !=
'\0'))
1632 _(
"query remote avr target for io space register values"));
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)
void set_gdbarch_address_class_type_flags_to_name(struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
static CORE_ADDR avr_pointer_to_address(struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
static struct frame_id avr_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
static const char * avr_register_name(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
CORE_ADDR get_frame_pc(struct frame_info *frame)
static CORE_ADDR avr_read_pc(struct regcache *regcache)
struct value * trad_frame_get_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], int regnum)
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
static int avr_address_class_type_flags(int byte_size, int dwarf2_addr_class)
int trad_frame_addr_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
static CORE_ADDR avr_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
void trad_frame_set_value(struct trad_frame_saved_reg this_saved_regs[], int regnum, LONGEST val)
int query(const char *ctlstr,...)
void set_gdbarch_write_pc(struct gdbarch *gdbarch, gdbarch_write_pc_ftype write_pc)
void set_gdbarch_integer_to_address(struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype integer_to_address)
LONGEST target_read_alloc(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte **buf_p)
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct cmd_list_element * add_info(const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
static CORE_ADDR avr_convert_iaddr_to_raw(CORE_ADDR x)
void internal_error(const char *file, int line, const char *fmt,...)
static CORE_ADDR avr_make_iaddr(CORE_ADDR x)
struct type * make_function_type(struct type *type, struct type **typeptr)
struct type * builtin_uint8
static CORE_ADDR avr_integer_to_address(struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
struct gdbarch_list * next
int gdbarch_num_regs(struct gdbarch *gdbarch)
static void avr_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buf)
const struct bfd_arch_info * bfd_arch_info
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
static void avr_address_to_pointer(struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
static struct stack_item * push_stack_item(struct stack_item *prev, const bfd_byte *contents, int len)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
static CORE_ADDR avr_unwind_sp(struct gdbarch *gdbarch, struct frame_info *next_frame)
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void printf_filtered(const char *format,...)
#define TYPE_CODE_SPACE(t)
static struct value * avr_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
static const char * avr_address_class_type_flags_to_name(struct gdbarch *gdbarch, int type_flags)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
#define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
static const struct frame_base avr_frame_base
void set_gdbarch_pseudo_register_write(struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype pseudo_register_write)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
struct type * check_typedef(struct type *type)
const gdb_byte * value_contents(struct value *value)
struct target_ops current_target
static struct gdbarch * avr_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
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)
static struct type * avr_register_type(struct gdbarch *gdbarch, int reg_nr)
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
static void avr_io_reg_read_command(const char *args, int from_tty)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
void set_gdbarch_address_to_pointer(struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype address_to_pointer)
#define gdb_assert_not_reached(message)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct type * func_void_type
struct type * arch_pointer_type(struct gdbarch *gdbarch, int bit, const char *name, struct type *target_type)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
static void avr_write_pc(struct regcache *regcache, CORE_ADDR val)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
struct type * builtin_uint32
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
void reinitialize_more_filter(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static int avr_address_class_name_to_type_flags(struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
void set_gdbarch_read_pc(struct gdbarch *gdbarch, gdbarch_read_pc_ftype read_pc)
void set_gdbarch_pointer_to_address(struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype pointer_to_address)
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
void printf_unfiltered(const char *format,...)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
typedef BP_MANIPULATION(avr_break_insn)
static CORE_ADDR avr_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)
static int avr_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int reg)
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 trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct gdbarch *gdbarch)
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)
static CORE_ADDR avr_scan_prologue(struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, struct avr_unwind_cache *info)
constexpr gdb_byte avr_break_insn[]
void _initialize_avr_tdep(void)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
static CORE_ADDR avr_make_saddr(CORE_ADDR x)
struct value * frame_unwind_got_optimized(struct frame_info *frame, int regnum)
static struct avr_unwind_cache * avr_frame_unwind_cache(struct frame_info *this_frame, void **this_prologue_cache)
static CORE_ADDR avr_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
static CORE_ADDR avr_convert_saddr_to_raw(CORE_ADDR x)
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype pseudo_register_read)
#define TYPE_TARGET_TYPE(thistype)
void set_gdbarch_address_class_type_flags(struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype address_class_type_flags)
static struct stack_item * pop_stack_item(struct stack_item *si)
struct trad_frame_saved_reg * saved_regs
void set_gdbarch_address_class_name_to_type_flags(struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
#define TYPE_CODE(thistype)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * builtin_data_ptr
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
struct minimal_symbol * minsym
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
static enum register_status avr_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buf)
static void avr_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
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 avr_frame_base_address(struct frame_info *this_frame, void **this_cache)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
struct type * value_type(const struct value *value)
const struct frame_base * base
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)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
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)
static const struct frame_unwind avr_frame_unwind
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)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
#define AVR_TYPE_ADDRESS_CLASS_FLASH
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
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 regcache_cooked_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)