/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2022 Free Software Foundation, Inc.
This file is part of GDB.
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- for (i = 0; i < TYPE_NFIELDS (type); i++)
+ for (i = 0; i < type->num_fields (); i++)
{
- int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i));
+ int falign = mn10300_type_align (type->field (i).type ());
while (align < falign)
align <<= 1;
}
case TYPE_CODE_UNION:
/* Structures with a single field are handled as the field
itself. */
- if (TYPE_NFIELDS (type) == 1)
- return mn10300_use_struct_convention (TYPE_FIELD_TYPE (type, 0));
+ if (type->num_fields () == 1)
+ return mn10300_use_struct_convention (type->field (0).type ());
/* Structures with word or double-word size are passed in memory, as
long as they require at least word alignment. */
information. */
static void
mn10300_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct mn10300_prologue *result)
+ CORE_ADDR start_pc, CORE_ADDR limit_pc,
+ struct mn10300_prologue *result)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc;
int rn;
pv_t regs[MN10300_MAX_NUM_REGS];
CORE_ADDR after_last_frame_setup_insn = start_pc;
- int am33_mode = AM33_MODE (gdbarch);
+ int am33_mode = get_am33_mode (gdbarch);
memset (result, 0, sizeof (*result));
result->gdbarch = gdbarch;
gdb_byte instr[2];
/* Instructions can be as small as one byte; however, we usually
- need at least two bytes to do the decoding, so fetch that many
+ need at least two bytes to do the decoding, so fetch that many
to begin with. */
status = target_read_memory (pc, instr, 2);
if (status != 0)
}
/* mov aM, aN */
else if ((instr[0] & 0xf0) == 0x90
- && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
+ && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
{
int aN = instr[0] & 0x03;
int aM = (instr[0] & 0x0c) >> 2;
}
/* mov dM, dN */
else if ((instr[0] & 0xf0) == 0x80
- && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
+ && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
{
int dN = instr[0] & 0x03;
int dM = (instr[0] & 0x0c) >> 2;
imm8 = extract_signed_integer (&instr[1], 1, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm8);
+ imm8);
pc += 2;
}
imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm16);
+ imm16);
pc += 4;
}
imm32 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm32);
+ imm32);
pc += 6;
}
/* fmov fsM, (rN) */
}
/* mov imm8, aN */
else if ((instr[0] & 0xf0) == 0x90)
- {
+ {
int aN = instr[0] & 0x03;
LONGEST imm8;
}
/* mov imm16, aN */
else if ((instr[0] & 0xfc) == 0x24)
- {
+ {
int aN = instr[0] & 0x03;
gdb_byte buf[2];
LONGEST imm16;
}
/* mov imm32, aN */
else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xdc))
- {
+ {
int aN = instr[1] & 0x03;
gdb_byte buf[4];
LONGEST imm32;
}
/* mov imm8, dN */
else if ((instr[0] & 0xf0) == 0x80)
- {
+ {
int dN = instr[0] & 0x03;
LONGEST imm8;
}
/* mov imm16, dN */
else if ((instr[0] & 0xfc) == 0x2c)
- {
+ {
int dN = instr[0] & 0x03;
gdb_byte buf[2];
LONGEST imm16;
}
/* mov imm32, dN */
else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xcc))
- {
+ {
int dN = instr[1] & 0x03;
gdb_byte buf[4];
LONGEST imm32;
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (!func_start)
- stop_addr = func_start;
+ stop_addr = func_start;
mn10300_analyze_prologue (get_frame_arch (this_frame),
func_start, stop_addr,
static struct value *
mn10300_frame_prev_register (struct frame_info *this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
struct mn10300_prologue *p
= mn10300_analyze_frame_prologue (this_frame, this_prologue_cache);
return a description of the stack slot holding it. */
if (p->reg_offset[regnum] != 1)
return frame_unwind_got_memory (this_frame, regnum,
- frame_base + p->reg_offset[regnum]);
+ frame_base + p->reg_offset[regnum]);
/* Otherwise, presume we haven't changed the value of this
register, and get it from the next frame. */
}
static const struct frame_unwind mn10300_frame_unwind = {
+ "mn10300 prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
mn10300_frame_this_id,
else
{
arg_len = TYPE_LENGTH (value_type (*args));
- val = value_contents (*args);
+ val = value_contents (*args).data ();
}
while (regs_used < 2 && arg_len > 0)
= gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
if (sp != unwound_sp)
regcache_cooked_write_unsigned (regcache, E_SP_REGNUM,
- sp - (unwound_sp - sp));
+ sp - (unwound_sp - sp));
}
return sp;
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int num_regs;
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
- tdep = XCNEW (struct gdbarch_tdep);
+ mn10300_gdbarch_tdep *tdep = new mn10300_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
switch (info.bfd_arch_info->mach)
static void
mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
- tdep->am33_mode);
+ mn10300_gdbarch_tdep *tdep = (mn10300_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ fprintf_filtered (file, "mn10300_dump_tdep: am33_mode = %d\n",
+ tdep->am33_mode);
}
void _initialize_mn10300_tdep ();