37 #include "opcodes/microblaze-opcm.h"
38 #include "opcodes/microblaze-dis.h"
50 #define IS_RETURN(op) (op == rtsd || op == rtid)
51 #define IS_UPDATE_SP(op, rd, ra) \
52 ((op == addik || op == addi) && rd == REG_SP && ra == REG_SP)
53 #define IS_SPILL_SP(op, rd, ra) \
54 ((op == swi || op == sw) && rd == REG_SP && ra == REG_SP)
55 #define IS_SPILL_REG(op, rd, ra) \
56 ((op == swi || op == sw) && rd != REG_SP && ra == REG_SP)
57 #define IS_ALSO_SPILL_REG(op, rd, ra, rb) \
58 ((op == swi || op == sw) && rd != REG_SP && ra == 0 && rb == REG_SP)
59 #define IS_SETUP_FP(op, ra, rb) \
60 ((op == add || op == addik || op == addk) && ra == REG_SP && rb == 0)
61 #define IS_SPILL_REG_FP(op, rd, ra, fpregnum) \
62 ((op == swi || op == sw) && rd != REG_SP && ra == fpregnum && ra != 0)
63 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
64 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
70 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
71 "r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15",
72 "r16",
"r17",
"r18",
"r19",
"r20",
"r21",
"r22",
"r23",
73 "r24",
"r25",
"r26",
"r27",
"r28",
"r29",
"r30",
"r31",
74 "rpc",
"rmsr",
"rear",
"resr",
"rfsr",
"rbtr",
75 "rpvr0",
"rpvr1",
"rpvr2",
"rpvr3",
"rpvr4",
"rpvr5",
"rpvr6",
76 "rpvr7",
"rpvr8",
"rpvr9",
"rpvr10",
"rpvr11",
77 "redr",
"rpid",
"rzpr",
"rtlbx",
"rtlbsx",
"rtlblo",
"rtlbhi",
81 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
143 *len =
sizeof (break_insn);
172 #define MICROBLAZE_MY_FRAME_IN_SP 0x1
179 #define MICROBLAZE_MY_FRAME_IN_FP 0x2
208 CORE_ADDR func_addr, func_end, addr, stop, prologue_end_addr = 0;
211 enum microblaze_instr op;
213 int save_hidden_pointer_found = 0;
214 int non_stack_instruction_found = 0;
241 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
248 stop = (current_pc < func_end ? current_pc : func_end);
251 name,
paddress (gdbarch, func_addr),
257 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
270 save_hidden_pointer_found = 0;
271 non_stack_instruction_found = 0;
280 save_hidden_pointer_found = 0;
282 non_stack_instruction_found = 0;
291 save_hidden_pointer_found = 0;
293 non_stack_instruction_found = 0;
302 save_hidden_pointer_found = 0;
304 non_stack_instruction_found = 0;
315 save_hidden_pointer_found = 0;
317 non_stack_instruction_found = 0;
326 save_hidden_pointer_found = 0;
328 non_stack_instruction_found = 0;
338 save_hidden_pointer_found = 1;
340 non_stack_instruction_found = 0;
349 if (!non_stack_instruction_found)
350 prologue_end_addr = addr;
351 non_stack_instruction_found = 1;
361 unsigned op = (unsigned)insn >> 26;
364 if (op != 0x26 && op != 0x27 && op != 0x2d && op != 0x2e && op != 0x2f)
380 if (save_hidden_pointer_found)
383 return prologue_end_addr;
409 CORE_ADDR func_start, func_end, ostart_pc;
420 if (sal.
end < func_end
421 && start_pc <= sal.
end)
428 if (ostart_pc > start_pc)
469 if (cache->
base == 0)
475 static struct value *
477 void **this_cache,
int regnum)
522 microblaze_frame_base_address
552 _(
"Unsupported return value size requested"));
573 memset (buf, 0,
sizeof(buf));
580 memcpy (buf, valbuf, 8);
585 memcpy (buf + 4 - len, valbuf, len);
680 "org.gnu.gdb.microblaze.core");
690 "org.gnu.gdb.microblaze.stack-protect");
759 if (tdesc_data != NULL)
778 Set microblaze debugging."),
_(
"\
779 Show microblaze debugging."),
_(
"\
780 When non-zero, microblaze specific debugging is enabled."),
struct gdbarch * target_gdbarch(void)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
#define IS_SPILL_REG(op, rd, ra)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
CORE_ADDR get_frame_address_in_block(struct frame_info *this_frame)
#define IS_SPILL_REG_FP(op, rd, ra, fpregnum)
struct type * builtin_func_ptr
struct trad_frame_saved_reg * saved_regs
void add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
struct value * trad_frame_get_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], int regnum)
struct target_desc * tdesc_microblaze_with_stack_protect
void set_gdbarch_write_pc(struct gdbarch *gdbarch, gdbarch_write_pc_ftype write_pc)
static int dwarf2_to_reg_map[78]
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
static CORE_ADDR microblaze_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct microblaze_frame_cache *cache)
void internal_error(const char *file, int line, const char *fmt,...)
void frame_unwind_register(struct frame_info *frame, int regnum, gdb_byte *buf)
#define MICROBLAZE_NUM_REGS
void set_gdbarch_stabs_argument_has_addr(struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
#define IS_SPILL_SP(op, rd, ra)
int gdbarch_num_regs(struct gdbarch *gdbarch)
#define MICROBLAZE_MY_FRAME_IN_FP
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
static CORE_ADDR microblaze_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc)
static void microblaze_frame_this_id(struct frame_info *next_frame, void **this_cache, struct frame_id *this_id)
void tdesc_data_cleanup(void *data_untyped)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
#define FRAME_OBSTACK_ZALLOC(TYPE)
static void microblaze_register_g_packet_guesses(struct gdbarch *gdbarch)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
#define IS_UPDATE_SP(op, rd, ra)
static CORE_ADDR microblaze_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
int target_read_code(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
int tdesc_numbered_register(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *name)
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
static unsigned long microblaze_fetch_instruction(CORE_ADDR pc)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
const struct frame_base * dwarf2_frame_base_sniffer(struct frame_info *this_frame)
static struct microblaze_frame_cache * microblaze_alloc_frame_cache(void)
#define IS_SETUP_FP(op, ra, rb)
void register_remote_g_packet_guess(struct gdbarch *gdbarch, int bytes, const struct target_desc *tdesc)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
static void initialize_tdesc_microblaze(void)
static void initialize_tdesc_microblaze_with_stack_protect(void)
#define MICROBLAZE_REGISTER_SIZE
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct target_desc * tdesc_microblaze
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
static CORE_ADDR microblaze_frame_base_address(struct frame_info *next_frame, void **this_cache)
void set_gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
void printf_unfiltered(const char *format,...)
struct cmd_list_element * setdebuglist
static struct microblaze_frame_cache * microblaze_frame_cache(struct frame_info *next_frame, void **this_cache)
static const char * microblaze_register_names[]
void set_gdbarch_frame_args_skip(struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)
const struct target_desc * target_desc
static int microblaze_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, int reg)
void vprintf_unfiltered(const char *format, va_list args)
#define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb)
void _initialize_microblaze_tdep(void)
struct trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct frame_info *this_frame)
static struct value * microblaze_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
void tdesc_use_registers(struct gdbarch *gdbarch, const struct target_desc *target_desc, struct tdesc_arch_data *early_data)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
static enum return_value_convention microblaze_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static const char * microblaze_register_name(struct gdbarch *gdbarch, int regnum)
int frame_relative_level(struct frame_info *fi)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * builtin_data_ptr
static void microblaze_write_pc(struct regcache *regcache, CORE_ADDR pc)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
static const gdb_byte * microblaze_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
struct tdesc_arch_data * tdesc_data_alloc(void)
void frame_base_append_sniffer(struct gdbarch *gdbarch, frame_base_sniffer_ftype *sniffer)
void set_gdbarch_call_dummy_location(struct gdbarch *gdbarch, int call_dummy_location)
#define MICROBLAZE_MY_FRAME_IN_SP
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
const struct tdesc_feature * tdesc_find_feature(const struct target_desc *target_desc, const char *name)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
struct cmd_list_element * showdebuglist
static void microblaze_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
#define TYPE_LENGTH(thistype)
static void microblaze_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
static struct gdbarch * microblaze_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
#define IS_ALSO_SPILL_REG(op, rd, ra, rb)
static struct type * microblaze_register_type(struct gdbarch *gdbarch, int regnum)
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
static struct gdbarch_data * tdesc_data
static const struct frame_unwind microblaze_frame_unwind
int register_offsets[MICROBLAZE_NUM_REGS]
static int microblaze_stabs_argument_has_addr(struct gdbarch *gdbarch, struct type *type)
static unsigned int microblaze_debug_flag
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
int tdesc_has_registers(const struct target_desc *target_desc)
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)
static void microblaze_debug(const char *fmt,...)
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)
struct type * builtin_int
#define MICROBLAZE_BREAKPOINT
const ULONGEST const LONGEST len