78 #define AVR_TYPE_ADDRESS_CLASS_FLASH TYPE_ADDRESS_CLASS_1
79 #define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH \
80 TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
146 AVR_EMEM_START = 0x00810000,
208 static const char *
const register_names[] = {
209 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
210 "r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15",
211 "r16",
"r17",
"r18",
"r19",
"r20",
"r21",
"r22",
"r23",
212 "r24",
"r25",
"r26",
"r27",
"r28",
"r29",
"r30",
"r31",
218 if (regnum >= (
sizeof (register_names) /
sizeof (*register_names)))
220 return register_names[
regnum];
254 return ((x) & 0xffffffff);
272 return ((x) & 0xffffffff);
529 len = pc_end - pc_beg;
548 static const unsigned char img[] = {
555 if ((insn & 0xf0f0) == 0xe0c0)
557 locals = (insn & 0xf) | ((insn & 0x0f00) >> 4);
560 if ((insn & 0xf0f0) == 0xe0d0)
562 locals |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
563 if (vpc + 4 +
sizeof (img) < len
564 && memcmp (prologue + vpc + 4, img,
sizeof (img)) == 0)
591 if ((insn & 0xf0f0) != 0xe0a0)
593 loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4);
598 if ((insn & 0xf0f0) != 0xe0b0)
600 loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
605 if ((insn & 0xf0f0) != 0xe0e0)
607 body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4);
612 if ((insn & 0xf0f0) != 0xe0f0)
614 body_addr |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
623 if ((insn & 0xf000) == 0xc000)
626 i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
632 if (body_addr != (pc_beg + 10)/2)
637 else if ((insn & 0xfe0e) == 0x940c)
640 i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
646 if (body_addr != (pc_beg + 12)/2)
678 info->
size = loc_size + num_pushes;
681 return pc_beg + pc_offset;
691 static const unsigned char img[] = {
699 if (len >=
sizeof (img)
700 && memcmp (prologue, img,
sizeof (img)) == 0)
709 else if (len >=
sizeof (img) - 2
710 && memcmp (img + 2, prologue,
sizeof (img) - 2) == 0)
713 vpc +=
sizeof (img) - 2;
724 for (; vpc <
len; vpc += 2)
727 if ((insn & 0xfe0f) == 0x920f)
730 int regno = (insn & 0x1f0) >> 4;
743 while (scan_stage == 1 && vpc < len)
751 else if (insn == 0x920f || insn == 0x921f)
765 if (scan_stage == 1 && vpc < len)
767 static const unsigned char img[] = {
772 if (vpc +
sizeof (img) < len
773 && memcmp (prologue + vpc, img,
sizeof (img)) == 0)
790 if (scan_stage == 2 && vpc < len)
793 static const unsigned char img[] = {
800 static const unsigned char img_sig[] = {
804 static const unsigned char img_int[] = {
812 if ((insn & 0xff30) == 0x9720)
814 locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
817 else if ((insn & 0xf0f0) == 0x50c0)
819 locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
823 locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4)) << 8;
832 if (vpc +
sizeof (img_sig) < len
833 && memcmp (prologue + vpc, img_sig,
sizeof (img_sig)) == 0)
835 vpc +=
sizeof (img_sig);
837 else if (vpc +
sizeof (img_int) < len
838 && memcmp (prologue + vpc, img_int,
sizeof (img_int)) == 0)
840 vpc +=
sizeof (img_int);
842 if (vpc +
sizeof (img) < len
843 && memcmp (prologue + vpc, img,
sizeof (img)) == 0)
849 info->
size += locals_size;
857 for (; vpc <
len; vpc += 2)
860 if ((insn & 0xff00) == 0x0100)
862 else if ((insn & 0xfc00) == 0x2c00)
883 if (post_prologue_pc != 0)
884 return max (pc, post_prologue_pc);
914 static const unsigned char *
918 static const unsigned char avr_break_insn [] = { 0x98, 0x95 };
919 *lenptr =
sizeof (avr_break_insn);
920 return avr_break_insn;
955 if (writebuf != NULL)
979 void **this_prologue_cache)
985 struct gdbarch *gdbarch;
989 if (*this_prologue_cache)
990 return *this_prologue_cache;
993 *this_prologue_cache = info;
1001 if ((start_pc > 0) && (start_pc <= current_pc))
1003 start_pc, current_pc, info);
1015 this_base += (high_base << 8);
1019 prev_sp = this_base + info->
size;
1026 prev_sp = this_base + info->
size;
1082 void **this_prologue_cache,
1105 static struct value *
1107 void **this_prologue_cache,
int regnum)
1142 pc = (pc << 8) | buf[i];
1178 avr_frame_base_address
1212 memcpy (si->
data, contents, len);
1283 (regcache, regnum--, (struct_addr >> 8) & 0xff);
1285 (regcache, regnum--, struct_addr & 0xff);
1288 if (sp == struct_addr)
1292 for (i = 0; i < nargs; i++)
1296 struct value *arg = args[i];
1302 last_regnum = regnum - (len + (len & 1));
1306 if ((si == NULL) && (last_regnum >= 8))
1315 for (j = 0; j <
len; j++)
1317 (regcache, regnum--, val >> (8 * (len - j - 1)));
1339 for (i = 1; i <= call_length; i++)
1341 buf[call_length - i] = return_pc & 0xff;
1355 return sp + call_length;
1363 if (reg >= 0 && reg < 32)
1368 warning (
_(
"Unmapped DWARF Register #%d encountered."), reg);
1385 if (dwarf2_addr_class == 1 && byte_size == 2)
1410 int *type_flags_ptr)
1412 if (strcmp (name,
"flash") == 0)
1423 static struct gdbarch *
1426 struct gdbarch *gdbarch;
1435 case bfd_mach_avrxmega1:
1437 case bfd_mach_avrxmega2:
1439 case bfd_mach_avrxmega3:
1441 case bfd_mach_avrxmega4:
1443 case bfd_mach_avrxmega5:
1448 case bfd_mach_avrxmega6:
1449 case bfd_mach_avrxmega7:
1561 unsigned int nreg = 0;
1567 "avr.io_reg", &buf);
1568 bufstr = (
const char *) buf;
1573 _(
"ERR: info io_registers NOT supported "
1574 "by current target\n"));
1578 if (sscanf (bufstr,
"%x", &nreg) != 1)
1581 _(
"Error fetching number of io registers\n"));
1595 for (i = 0; i < nreg; i += step)
1602 snprintf (query,
sizeof (query) - 1,
"avr.io_reg:%x,%x", i, j);
1606 p = (
const char *) buf;
1607 for (k = i; k < (i + j); k++)
1609 if (sscanf (p,
"%[^,],%x;", query, &val) == 2)
1612 while ((*p !=
';') && (*p !=
'\0'))
1639 _(
"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)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
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)
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)
initialize_file_ftype _initialize_avr_tdep
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)
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 warning(const char *fmt,...)
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)
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)
static const unsigned char * avr_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
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)
static enum return_value_convention avr_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
static void avr_io_reg_read_command(char *args, int from_tty)
static CORE_ADDR avr_unwind_sp(struct gdbarch *gdbarch, struct frame_info *next_frame)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
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)
struct cmd_list_element * infolist
#define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_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
void initialize_file_ftype(void)
static struct gdbarch * avr_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
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)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
void set_gdbarch_address_to_pointer(struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype address_to_pointer)
#define gdb_assert_not_reached(message)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct type * func_void_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)
void set_gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_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)
static int avr_address_class_name_to_type_flags(struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
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)
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_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)
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)
struct trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct frame_info *this_frame)
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 ui_file * gdb_stderr
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)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int length, char *name)
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)
enum bfd_endian byte_order
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)
void set_gdbarch_print_insn(struct gdbarch *gdbarch, gdbarch_print_insn_ftype print_insn)
const ULONGEST const LONGEST len