158 "af",
"bc",
"de",
"hl",
159 "sp",
"pc",
"ix",
"iy",
160 "af'",
"bc'",
"de'",
"hl'",
313 gdb_byte prologue[32];
319 len = pc_end - pc_beg;
320 if (len > (
int)
sizeof (prologue))
321 len =
sizeof (prologue);
331 regs[0] = reg & 0xff;
337 if (i == -1 && pos > 0)
338 info->prologue_type.load_args = 1;
343 else if (!memcmp (&prologue[pos],
"\355\127\363\365", 4))
345 info->prologue_type.critical = 1;
347 info->state_size += addr_len;
349 else if (!memcmp (&prologue[pos],
"\365\305\325\345\375\345", 6))
351 info->prologue_type.interrupt = 1;
353 info->state_size += addr_len * 5;
357 if (prologue[pos] == 0xcd)
367 info->prologue_type.fp_sdcc = 1;
371 else if (!memcmp (&prologue[pos],
"\335\345\335\041\000\000", 4+addr_len) &&
372 !memcmp (&prologue[pos+4+addr_len],
"\335\071\335\371", 4))
374 pos += 4 + addr_len + 4;
375 info->prologue_type.fp_sdcc = 1;
377 else if (!memcmp (&prologue[pos],
"\335\345", 2))
380 info->prologue_type.fp_sdcc = 1;
384 switch (prologue[pos])
388 while (prologue[pos] == 0xf5)
390 info->size += addr_len;
393 if (prologue[pos] == 0x3b)
401 while (prologue[pos] == 0x3b)
408 if (prologue[pos+addr_len] == 0x39 && prologue[pos+addr_len] >= 0x80 &&
409 prologue[pos+addr_len+1] == 0xf9)
412 pos += 1 + addr_len + 2;
416 if (prologue[pos+1] == 0x21 && prologue[pos+1+addr_len] >= 0x80 &&
417 !memcmp (&prologue[pos+2+addr_len],
"\375\071\375\371", 4))
420 pos += 2 + addr_len + 4;
424 switch (prologue[pos+1])
427 if (prologue[pos+2] >= 0x80 && prologue[pos+3] == 0xf9)
434 if (prologue[pos+2] >= 0x80 && prologue[pos+3] == 0xfd &&
435 prologue[pos+4] == 0xf9)
446 if (info->prologue_type.interrupt)
455 if (info->prologue_type.critical)
458 if (info->prologue_type.fp_sdcc)
461 info->state_size += len * addr_len;
469 CORE_ADDR func_addr, func_end;
470 CORE_ADDR prologue_end;
476 if (prologue_end != 0)
477 return std::max (pc, prologue_end);
483 info.saved_regs = saved_regs;
490 if (info.prologue_type.fp_sdcc || info.prologue_type.interrupt ||
491 info.prologue_type.critical)
492 return std::max (pc, prologue_end);
495 if (prologue_end != 0)
499 const char *debug_format = compunit->
debugformat ();
501 if (debug_format != NULL &&
502 !strncasecmp (
"dwarf", debug_format, strlen(
"dwarf")))
503 return std::max (pc, prologue_end);
522 gdb_byte *readbuf,
const gdb_byte *writebuf)
525 int len = valtype->
length ();
527 if ((valtype->
code () == TYPE_CODE_STRUCT
528 || valtype->
code () == TYPE_CODE_UNION
529 || valtype->
code () == TYPE_CODE_ARRAY)
533 if (writebuf != NULL)
559 void **this_prologue_cache)
561 CORE_ADDR start_pc, current_pc;
564 gdb_byte buf[
sizeof(
void*)];
570 if (*this_prologue_cache)
576 *this_prologue_cache =
info;
580 if ((start_pc > 0) && (start_pc <= current_pc))
582 start_pc, current_pc,
info);
584 if (
info->prologue_type.fp_sdcc)
589 info->prev_sp = this_base +
info->size;
600 sp = this_base +
info->size;
606 sp = this_base +
info->size;
613 if (buf[0] == 0xcd || (buf[0] & 0307) == 0304)
615 static const char *names[] =
617 "__sdcc_call_ix",
"__sdcc_call_iy",
"__sdcc_call_hl"
620 if (addr == start_pc)
622 for (i =
sizeof(names)/
sizeof(*names)-1; i >= 0; --i)
644 if (info->saved_regs[i].addr () > 0)
645 info->saved_regs[i].set_addr
646 (info->prev_sp - info->saved_regs[i].addr () * addr_len);
654 info->saved_regs[
Z80_SP_REGNUM].set_value (info->prev_sp + addr_len);
676 base = info->prev_sp;
686 void **this_prologue_cache,
int regnum)
719 static int addr = -1;
728 warning(_(
"Unable to determine inferior's software breakpoint type: "
729 "couldn't find `_break_handler' function in inferior. Will "
730 "be used default software breakpoint instruction RST 0x08."));
741static const gdb_byte *
744 static gdb_byte break_insn[8];
746 if ((kind & 070) == kind)
748 break_insn[0] = kind | 0307;
754 gdb_byte *p = break_insn;
756 *p++ = (kind >> 0) & 0xff;
757 *p++ = (kind >> 8) & 0xff;
759 *p++ = (kind >> 16) & 0xff;
760 *
size = p - break_insn;
770static std::vector<CORE_ADDR>
773 static const int flag_mask[] = {1 << 6, 1 << 0, 1 << 2, 1 << 7};
780 std::vector<CORE_ADDR> ret (1);
786 ret[0] = addr +
size;
797 if ((t & 0xff00) != 0x100)
808 if ((opcode & 010) != 0)
812 if (t & flag_mask[(opcode >> 4) & 3])
826 addr += (
signed char)buf[
size-1];
839 addr = buf[
size-1] * 0x100 + buf[
size-2];
841 addr = addr * 0x100 + buf[
size-3];
850 addr = buf[1] * 0x100 + buf[0];
852 addr = addr * 0x100 + buf[2];
883 int len,
int size,
enum bfd_endian byte_order)
886 gdb_byte *buf = (gdb_byte *) alloca (len *
size);
890 for (i = 0; i < len; i++)
901 enum bfd_endian byte_order;
905 if (! novly_regions_msym.
minsym)
907 error (_(
"Error reading inferior's overlay table: "
908 "couldn't find `_novly_regions'\n"
909 "variable in inferior. Use `overlay manual' mode."));
914 if (! ovly_region_table_msym.
minsym)
916 error (_(
"Error reading inferior's overlay table: couldn't find "
917 "`_ovly_region_table'\n"
918 "array in inferior. Use `overlay manual' mode."));
951 unsigned vma = bfd_section_vma (bsect);
968 sect->ovly_mapped = (lma == bfd_section_lma (sect->the_bfd_section));
969 i |= sect->ovly_mapped;
993 asection *bsect = sect->the_bfd_section;
994 bfd_vma lma = bfd_section_lma (bsect);
995 bfd_vma vma = bfd_section_vma (bsect);
1086 unsigned long mach = info.bfd_arch_info->mach;
1087 const struct target_desc *tdesc = info.target_desc;
1096 const struct tdesc_feature *feature;
1100 if (feature == NULL)
1129 if (mach == bfd_mach_ez80_adl)
1399 case bfd_mach_ez80_z80:
1402 case bfd_mach_ez80_adl:
1411 for (; ((
code = buf[*
size]) & info->mask) != info->code; ++info)
1413 *
size += info->size;
1418 if (mach == bfd_mach_ez80_z80 || mach == bfd_mach_ez80_adl)
1436 if (mach == bfd_mach_ez80_z80 || mach == bfd_mach_ez80_adl)
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)
struct gdbarch * target_gdbarch(void)
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_part(int regnum, int offset, int len, const gdb_byte *buf)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
void initialize_file_ftype(void)
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
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
int default_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_prologue_cache)
struct value * frame_unwind_got_optimized(frame_info_ptr frame, int 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)
CORE_ADDR get_frame_func(frame_info_ptr this_frame)
#define FRAME_OBSTACK_ZALLOC(TYPE)
void set_gdbarch_addr_bit(struct gdbarch *gdbarch, int addr_bit)
void set_gdbarch_insn_is_jump(struct gdbarch *gdbarch, gdbarch_insn_is_jump_ftype *insn_is_jump)
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_max_insn_length(struct gdbarch *gdbarch, ULONGEST max_insn_length)
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_overlay_update(struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update)
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)
int gdbarch_num_regs(struct gdbarch *gdbarch)
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)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
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)
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
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_insn_is_ret(struct gdbarch *gdbarch, gdbarch_insn_is_ret_ftype *insn_is_ret)
void set_gdbarch_insn_is_call(struct gdbarch *gdbarch, gdbarch_insn_is_call_ftype *insn_is_call)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
int gdbarch_long_bit(struct gdbarch *gdbarch)
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
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)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, gdbarch_tdep_up tdep)
std::unique_ptr< gdbarch_tdep_base > gdbarch_tdep_up
struct type * init_pointer_type(type_allocator &alloc, int bit, const char *name, struct type *target_type)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * make_function_type(struct type *type, struct type **typeptr)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
struct program_space * current_program_space
void(* func)(remote_target *remote, char *)
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct type * builtin_data_ptr
const char * debugformat() const
struct gdbarch_list * next
struct bfd_section * the_bfd_section
iterator_range< section_iterator > sections()
struct gdbarch * arch() const
objfiles_range objfiles()
struct compunit_symtab * compunit() const
struct type * func_void_type
enum z80_instruction_type type
struct z80_unwind_cache::@215 prologue_type
struct trad_frame_saved_reg * saved_regs
int section_is_overlay(struct obj_section *section)
enum overlay_debugging_state overlay_debugging
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
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)
std::unique_ptr< tdesc_arch_data, tdesc_arch_data_deleter > tdesc_arch_data_up
trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct gdbarch *gdbarch)
struct value * trad_frame_get_prev_register(frame_info_ptr this_frame, trad_frame_saved_reg this_saved_regs[], int regnum)
static const struct z80_insn_info ez80_adl_ddfd_insn_table[]
static int z80_overlay_update_1(struct obj_section *osect)
static int z80_scan_prologue(struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, struct z80_unwind_cache *info)
static struct type * z80_register_type(struct gdbarch *gdbarch, int reg_nr)
static const struct z80_insn_info ez80_ddfd_insn_table[]
static const char * z80_register_name(struct gdbarch *gdbarch, int regnum)
static int z80_is_push_rr(const gdb_byte buf[], int *size)
static int z80_read_overlay_region_table()
static void z80_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static void read_target_long_array(CORE_ADDR memaddr, unsigned int *myaddr, int len, int size, enum bfd_endian byte_order)
static const gdb_byte * z80_sw_breakpoint_from_kind(struct gdbarch *gdbarch, int kind, int *size)
static const struct z80_insn_info ez80_main_insn_table[]
static int z80_insn_is_jump(struct gdbarch *gdbarch, CORE_ADDR addr)
static struct gdbarch * z80_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static const struct frame_unwind z80_frame_unwind
static enum return_value_convention z80_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static CORE_ADDR z80_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
static void z80_free_overlay_region_table(void)
static void z80_overlay_update(struct obj_section *osect)
static int z80_insn_is_call(struct gdbarch *gdbarch, CORE_ADDR addr)
initialize_file_ftype _initialize_z80_tdep
static const struct z80_insn_info ez80_adl_main_insn_table[]
static const struct z80_insn_info ez80_adl_ed_insn_table[]
static const struct z80_insn_info ez80_ed_insn_table[]
static unsigned cache_novly_regions
static const char * z80_reg_names[]
static CORE_ADDR cache_ovly_region_table_base
static const struct z80_insn_info * z80_get_insn_info(struct gdbarch *gdbarch, const gdb_byte *buf, int *size)
static int z80_is_pop_rr(const gdb_byte buf[], int *size)
static struct z80_unwind_cache * z80_frame_unwind_cache(frame_info_ptr this_frame, void **this_prologue_cache)
static int z80_breakpoint_kind_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static int z80_insn_is_ret(struct gdbarch *gdbarch, CORE_ADDR addr)
static struct value * z80_frame_prev_register(frame_info_ptr this_frame, void **this_prologue_cache, int regnum)
static std::vector< CORE_ADDR > z80_software_single_step(struct regcache *regcache)
static unsigned(* cache_ovly_region_table)[3]
static void initialize_tdesc_z80(void)
const struct target_desc * tdesc_z80