35#include "floatformat.h"
43#define P_LINKL_FP 0x480e
44#define P_LINKW_FP 0x4e56
45#define P_PEA_FP 0x4856
46#define P_MOVEAL_SP_FP 0x2c4f
47#define P_ADDAW_SP 0xdefc
48#define P_ADDAL_SP 0xdffc
49#define P_SUBQW_SP 0x514f
50#define P_SUBQL_SP 0x518f
51#define P_LEA_SP_SP 0x4fef
52#define P_LEA_PC_A5 0x4bfb0170
53#define P_FMOVEMX_SP 0xf227
54#define P_MOVEL_SP 0x2f00
55#define P_MOVEML_SP 0x48e7
58#define SP_ARG0 (1 * 4)
60#if !defined (BPT_VECTOR)
164 "d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
165 "a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"fp",
"sp",
167 "fp0",
"fp1",
"fp2",
"fp3",
"fp4",
"fp5",
"fp6",
"fp7",
168 "fpcontrol",
"fpstatus",
"fpiaddr"
210 int *optimizedp,
int *unavailablep)
216 gdb_assert (
type->
code () == TYPE_CODE_FLT);
220 gdb::make_array_view (from,
223 optimizedp, unavailablep))
227 *optimizedp = *unavailablep = 0;
236 struct type *
type,
const gdb_byte *from)
245 warning (_(
"Cannot convert non-floating-point type "
246 "to floating-point register value."));
300 if (
type->
code () == TYPE_CODE_PTR && len == 4)
309 memcpy (valbuf, buf + (4 - len), len);
314 memcpy (valbuf, buf + (8 - len), len - 4);
318 internal_error (_(
"Cannot extract return value of %d bytes long."), len);
343 const gdb_byte *valbuf)
347 if (
type->
code () == TYPE_CODE_PTR && len == 4)
364 internal_error (_(
"Cannot store return value of %d bytes long."), len);
369 const gdb_byte *valbuf)
396 gdb_assert (
code == TYPE_CODE_STRUCT ||
code == TYPE_CODE_UNION
397 ||
code == TYPE_CODE_COMPLEX ||
code == TYPE_CODE_ARRAY);
416 if (!
is_vector && (len == 2 || len == 4 || len == 8))
419 return (len == 1 || len == 2 || len == 4 || len == 8);
431 gdb_byte *readbuf,
const gdb_byte *writebuf)
436 if (((
code == TYPE_CODE_STRUCT ||
code == TYPE_CODE_UNION
437 ||
code == TYPE_CODE_COMPLEX ||
code == TYPE_CODE_ARRAY)
467 gdb_byte *readbuf,
const gdb_byte *writebuf)
474 if ((
code == TYPE_CODE_STRUCT ||
code == TYPE_CODE_UNION)
482 if (((
code == TYPE_CODE_STRUCT ||
code == TYPE_CODE_UNION
483 ||
code == TYPE_CODE_COMPLEX ||
code == TYPE_CODE_ARRAY)
487 &&
code == TYPE_CODE_FLT
538 struct value **args, CORE_ADDR sp,
540 CORE_ADDR struct_addr)
548 for (i = nargs - 1; i >= 0; i--)
550 struct type *value_type = args[i]->enclosing_type ();
551 int len = value_type->
length ();
552 int container_len = (len + 3) & ~3;
557 if ((value_type->
code () == TYPE_CODE_STRUCT
558 || value_type->
code () == TYPE_CODE_UNION
559 || value_type->
code () == TYPE_CODE_ARRAY)
563 offset = container_len - len;
565 write_memory (sp + offset, args[i]->contents_all ().data (), len);
605 else if (num < 24 && tdep->fpregs_present)
665 CORE_ADDR
pc, CORE_ADDR current_pc,
671 if (
pc >= current_pc)
686 if (
pc + 4 < current_pc && cache->
locals == 0)
709 if (
pc + 2 < current_pc)
727 cache->
locals = (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
728 if (
pc + 2 < current_pc)
733 cache->
locals += (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
763 CORE_ADDR current_pc,
775 offset = -4 - cache->
locals;
776 while (
pc < current_pc)
784 if ((op & 0xff00) == 0xe000)
787 for (i = 0; i < 16; i++, mask >>= 1)
812 for (i = 0; i < 16; i++, mask >>= 1)
872 if (
pc >= current_pc)
938 if (cache->
base == 0)
984 if (cache->
base == 0)
1057 CORE_ADDR sp, jb_addr;
1062 if (tdep->
jb_pc < 0)
1064 internal_error (_(
"m68k_get_longjmp_target: not implemented"));
1076 / TARGET_CHAR_BIT, byte_order);
1084 / TARGET_CHAR_BIT, byte_order);
1147 const struct tdesc_feature *feature;
1151 "org.gnu.gdb.m68k.core");
1153 if (feature == NULL)
1156 "org.gnu.gdb.coldfire.core");
1157 if (feature != NULL)
1161 if (feature == NULL)
1164 "org.gnu.gdb.fido.core");
1165 if (feature != NULL)
1169 if (feature == NULL)
1183 "org.gnu.gdb.coldfire.fp");
1184 if (feature != NULL)
1201 if (info.bfd_arch_info && info.bfd_arch_info->mach != 0)
1203 const bfd_arch_info_type *coldfire_arch =
1204 bfd_lookup_arch (bfd_arch_m68k, bfd_mach_mcf_isa_a_nodiv);
1207 && ((*info.bfd_arch_info->compatible)
1208 (info.bfd_arch_info, coldfire_arch)))
1215 int float_return = 0;
1219 if (info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
1221 int fp_abi = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
1222 Tag_GNU_M68K_ABI_FP);
1225 else if (fp_abi == 2)
1236 = gdbarch_tdep<m68k_gdbarch_tdep> (best_arch->
gdbarch);
1238 if (flavour != tdep->flavour)
1250 if (best_arch != NULL)
1259 tdep->flavour = flavour;
1300#if defined JB_PC && defined JB_ELEMENT_SIZE
1301 tdep->
jb_pc = JB_PC;
1325 if (tdep->
jb_pc >= 0)
1351 unsigned int elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
1353 if (elfosabi == ELFOSABI_NONE)
gdb_static_assert(sizeof(splay_tree_key) >=sizeof(CORE_ADDR *))
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)
#define BP_MANIPULATION(BREAK_INSN)
enum register_status raw_read(int regnum, gdb_byte *buf)
void cooked_write(int regnum, const gdb_byte *buf)
void raw_write_part(int regnum, int offset, int len, const gdb_byte *buf)
void raw_write(int regnum, 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)
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)
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_ABI_RETURNS_ADDRESS
@ RETURN_VALUE_REGISTER_CONVENTION
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
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)
void get_frame_register(frame_info_ptr frame, int regnum, gdb_byte *buf)
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)
bool get_frame_register_bytes(frame_info_ptr frame, int regnum, CORE_ADDR offset, gdb::array_view< gdb_byte > buffer, int *optimizedp, int *unavailablep)
void put_frame_register(frame_info_ptr frame, int regnum, const gdb_byte *buf)
#define FRAME_OBSTACK_ZALLOC(TYPE)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc)
void set_gdbarch_ps_regnum(struct gdbarch *gdbarch, int ps_regnum)
void set_gdbarch_register_to_value(struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void set_gdbarch_value_to_register(struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register)
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc)
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_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
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_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
void set_gdbarch_fp0_regnum(struct gdbarch *gdbarch, int fp0_regnum)
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)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
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_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum)
void set_gdbarch_convert_register_p(struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p)
int gdbarch_fp0_regnum(struct gdbarch *gdbarch)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
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_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call)
void set_gdbarch_frame_args_skip(struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)
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
void append_flags_type_flag(struct type *type, int bitpos, const char *name)
const struct floatformat * floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN]
struct type * arch_flags_type(struct gdbarch *gdbarch, const char *name, int bit)
struct type * init_float_type(type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
unsigned type_align(struct type *type)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
struct type * check_typedef(struct type *type)
static void m68k_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
static struct type * m68881_ext_type(struct gdbarch *gdbarch)
static void m68k_embedded_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
void _initialize_m68k_tdep()
static CORE_ADDR m68k_unwind_pc(struct gdbarch *gdbarch, frame_info_ptr next_frame)
static enum return_value_convention m68k_svr4_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static void m68k_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static CORE_ADDR m68k_analyze_register_saves(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct m68k_frame_cache *cache)
static struct type * m68k_register_type(struct gdbarch *gdbarch, int regnum)
static void m68k_svr4_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
void m68k_svr4_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static struct m68k_frame_cache * m68k_frame_cache(frame_info_ptr this_frame, void **this_cache)
static void m68k_dump_tdep(struct gdbarch *gdbarch, struct ui_file *file)
static CORE_ADDR m68k_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 const struct frame_unwind m68k_frame_unwind
static struct value * m68k_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
static int m68k_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int num)
static CORE_ADDR m68k_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc)
static int m68k_reg_struct_return_p(struct gdbarch *gdbarch, struct type *type)
static enum gdb_osabi m68k_osabi_sniffer(bfd *abfd)
static const char * m68k_register_name(struct gdbarch *gdbarch, int regnum)
static int m68k_return_in_first_hidden_param_p(struct gdbarch *gdbarch, struct type *type)
static enum return_value_convention m68k_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static void m68k_value_to_register(frame_info_ptr frame, int regnum, struct type *type, const gdb_byte *from)
static const struct frame_base m68k_frame_base
static int m68k_get_longjmp_target(frame_info_ptr frame, CORE_ADDR *pc)
static void m68k_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
constexpr gdb_byte m68k_break_insn[]
static void m68k_svr4_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static CORE_ADDR m68k_analyze_frame_setup(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct m68k_frame_cache *cache)
static struct gdbarch * m68k_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
static struct m68k_frame_cache * m68k_alloc_frame_cache(void)
static int m68k_register_to_value(frame_info_ptr frame, int regnum, struct type *type, gdb_byte *to, int *optimizedp, int *unavailablep)
static int m68k_convert_register_p(struct gdbarch *gdbarch, int regnum, struct type *type)
static struct frame_id m68k_dummy_id(struct gdbarch *gdbarch, frame_info_ptr this_frame)
static const char *const m68k_register_names[]
static CORE_ADDR m68k_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct m68k_frame_cache *cache)
static CORE_ADDR m68k_frame_base_address(frame_info_ptr this_frame, void **this_cache)
static CORE_ADDR m68k_frame_align(struct gdbarch *gdbarch, CORE_ADDR sp)
#define M68K_MAX_REGISTER_SIZE
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
void gdbarch_register_osabi_sniffer(enum bfd_architecture arch, enum bfd_flavour flavour, enum gdb_osabi(*sniffer_fn)(bfd *))
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
int register_size(struct gdbarch *gdbarch, int regnum)
struct type * register_type(struct gdbarch *gdbarch, int regnum)
struct type * builtin_int0
struct type * builtin_double
struct type * builtin_func_ptr
struct type * builtin_data_ptr
struct type * builtin_int32
struct type * type() const
struct gdbarch_list * next
CORE_ADDR saved_regs[M68K_NUM_REGS]
int pointer_result_regnum
struct type * m68881_ext_type
struct type * m68k_ps_type
struct type * target_type() const
struct field & field(int idx) const
unsigned int num_fields() const
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
void target_float_convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)