/* Target-dependent code for the Renesas RL78 for GDB, the GNU debugger.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2017 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
int reg_offset[RL78_NUM_TOTAL_REGS];
};
+/* Construct type for PSW register. */
+
+static struct type *
+rl78_psw_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (tdep->rl78_psw_type == NULL)
+ {
+ tdep->rl78_psw_type = arch_flags_type (gdbarch,
+ "builtin_type_rl78_psw", 1);
+ append_flags_type_flag (tdep->rl78_psw_type, 0, "CY");
+ append_flags_type_flag (tdep->rl78_psw_type, 1, "ISP0");
+ append_flags_type_flag (tdep->rl78_psw_type, 2, "ISP1");
+ append_flags_type_flag (tdep->rl78_psw_type, 3, "RBS0");
+ append_flags_type_flag (tdep->rl78_psw_type, 4, "AC");
+ append_flags_type_flag (tdep->rl78_psw_type, 5, "RBS1");
+ append_flags_type_flag (tdep->rl78_psw_type, 6, "Z");
+ append_flags_type_flag (tdep->rl78_psw_type, 7, "IE");
+ }
+
+ return tdep->rl78_psw_type;
+}
+
/* Implement the "register_type" gdbarch method. */
static struct type *
else if (reg_nr == RL78_RAW_PC_REGNUM)
return tdep->rl78_uint32;
else if (reg_nr == RL78_PSW_REGNUM)
- return (tdep->rl78_psw_type);
+ return rl78_psw_type (gdbarch);
else if (reg_nr <= RL78_MEM_REGNUM
|| (RL78_X_REGNUM <= reg_nr && reg_nr <= RL78_H_REGNUM)
|| (RL78_BANK0_R0_REGNUM <= reg_nr
{0x61, 0xcc}, but instructions may be as short as one byte.
Correspondence with Renesas revealed that the one byte sequence
0xff is used when a one byte breakpoint instruction is required. */
-static gdb_byte breakpoint[] = { 0xff };
+constexpr gdb_byte rl78_break_insn[] = { 0xff };
-GDBARCH_BREAKPOINT_MANIPULATION (rl78, breakpoint)
+typedef BP_MANIPULATION (rl78_break_insn) rl78_breakpoint;
/* Define a "handle" struct for fetching the next opcode. */
tdep->rl78_code_pointer
= arch_pointer_type (gdbarch, 32, "rl78_code_addr_t", tdep->rl78_void);
- tdep->rl78_psw_type = arch_flags_type (gdbarch, "builtin_type_rl78_psw", 1);
- append_flags_type_flag (tdep->rl78_psw_type, 0, "CY");
- append_flags_type_flag (tdep->rl78_psw_type, 1, "ISP0");
- append_flags_type_flag (tdep->rl78_psw_type, 2, "ISP1");
- append_flags_type_flag (tdep->rl78_psw_type, 3, "RBS0");
- append_flags_type_flag (tdep->rl78_psw_type, 4, "AC");
- append_flags_type_flag (tdep->rl78_psw_type, 5, "RBS1");
- append_flags_type_flag (tdep->rl78_psw_type, 6, "Z");
- append_flags_type_flag (tdep->rl78_psw_type, 7, "IE");
-
/* Registers. */
set_gdbarch_num_regs (gdbarch, RL78_NUM_REGS);
set_gdbarch_num_pseudo_regs (gdbarch, RL78_NUM_PSEUDO_REGS);
set_gdbarch_addr_bits_remove (gdbarch, rl78_addr_bits_remove);
/* Breakpoints. */
- SET_GDBARCH_BREAKPOINT_MANIPULATION (rl78);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, rl78_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, rl78_breakpoint::bp_from_kind);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
/* Disassembly. */