diff options
Diffstat (limited to 'gdb')
45 files changed, 384 insertions, 141 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b9b43d7..c133951 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,161 @@ 2016-11-03 Yao Qi <yao.qi@linaro.org> + Pedro Alves <palves@redhat.com> + + * aarch64-tdep.c (aarch64_default_breakpoint): Change it to + constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (aarch64_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * alpha-tdep.c (break_insn): Rename to alpha_break_insn. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (alpha_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * arc-tdep.c (arc_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Remove. + (struct bp_manipulation): New. + (SET_GDBARCH_BREAKPOINT_MANIPULATION): Remove. + (struct bp_manipulation_endian): New. + (BP_MANIPULATION): New. + (BP_MANIPULATION_ENDIAN): New. + * arm-tdep.c (arm_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * avr-tdep.c (avr_break_insn): Change it constexpr. + (avr_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * bfin-tdep.c (bfin_gdbarch_init): Likewise. + * cris-tdep.c (cris_gdbarch_init): Likewise. + * frv-tdep.c (breakpoint): Rename it to frv_break_insn, and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (frv_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * ft32-tdep.c (breakpoint): Rename it to ft32_break_insn and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (ft32_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * h8300-tdep.c (breakpoint): Rename it to h8300_break_insn. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (h8300_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * hppa-tdep.c (breakpoint): Rename it to h8300_break_insn. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (hppa_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * i386-tdep.c (break_insn): Rename it to i386_break_insn. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (i386_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * iq2000-tdep.c (iq2000_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * lm32-tdep.c (breakpoint): Rename it to lm32_break_insn and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (lm32_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * m32c-tdep.c (break_insn): Rename it to m32c_break_insn and change + its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (m32c_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * m32r-tdep.c (m32r_gdbarch_init): Likewise. + * m68hc11-tdep.c (breakpoint): Rename it to m68hc11_break_insn and + change its type to constexpr. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (m68hc11_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. + * m68k-tdep.c (break_insn): Rename it to m68k_break_insn and change + its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (m68k_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * m88k-tdep.c (break_insn): Rename it to m88k_break_insn and change + its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (m88k_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * mep-tdep.c (breakpoint): Rename it to mep_break_insn and change + its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (mep_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * microblaze-tdep.c (break_insn): Rename it to + microblaze_break_insn and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (microblaze_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * mips-tdep.c (mips_gdbarch_init): Likewise. + * mn10300-tdep.c (breakpoint): Rename it to mn10300_break_insn and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (mn10300_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * moxie-tdep.c (breakpoint): Rename it to moxie_break_insn and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (moxie_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * msp430-tdep.c (breakpoint): Rename it to msp430_break_insn + and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (msp430_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * mt-tdep.c (mt_gdbarch_init): Likewise. + * nds32-tdep.c (break_insn): Rename it to nds32_break_insn + and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (nds32_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * nios2-tdep.c (nios2_gdbarch_init): Likewise. + * rl78-tdep.c (breakpoint): Rename it to rl78_break_ins + and change its type to rl78_break_insn. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (rl78_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * rs6000-tdep.c (big_breakpoint): Change its type to + constexpr. + (little_breakpoint): Likewise. + Don't use GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN. + (rs6000_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * rx-tdep.c (breakpoint): Rename it to rx_break_insn and + change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (rx_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * s390-linux-tdep.c (breakpoint): Rename it to s390_break_insn + and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION + (s390_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * score-tdep.c (score_gdbarch_init): Likewise. + * sh-tdep.c (sh_gdbarch_init): Likewise. + * sh64-tdep.c (sh64_gdbarch_init): Likewise. + * sparc-tdep.c (break_insn): Rename it to sparc_break_insn + and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (sparc32_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * spu-tdep.c (breakpoint): Rename it to spu_break_insn and change + its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (spu_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. + * tilegx-tdep.c (breakpoint): Rename it to tilegx_break_insn + and change its type to constexpr. Don't use + GDBARCH_BREAKPOINT_MANIPULATION. + (tilegx_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * v850-tdep.c (v850_gdbarch_init): Likewise. + * vax-tdep.c (break_insn): Rename it to vax_break_insn and + change its type to constexpr. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (vax_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * xstormy16-tdep.c (breakpoint): Rename it to + xstormy16_break_insn and change its type to constexpr. + Don't use GDBARCH_BREAKPOINT_MANIPULATION. + (xstormy16_gdbarch_init): Don't use + SET_GDBARCH_BREAKPOINT_MANIPULATION. + * xtensa-tdep.c (xtensa_gdbarch_init): Likewise. + +2016-11-03 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_override_mode): Remove. (arm_pc_is_thumb): Update. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 304d9df..1298302 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1590,9 +1590,9 @@ aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info) /* AArch64 BRK software debug mode instruction. Note that AArch64 code is always little-endian. 1101.0100.0010.0000.0000.0000.0000.0000 = 0xd4200000. */ -static const gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4}; +constexpr gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4}; -GDBARCH_BREAKPOINT_MANIPULATION (aarch64, aarch64_default_breakpoint) +typedef BP_MANIPULATION (aarch64_default_breakpoint) aarch64_breakpoint; /* Extract from an array REGS containing the (raw) register state a function return value of type TYPE, and copy that, in virtual @@ -2754,7 +2754,10 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Breakpoint manipulation. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (aarch64); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + aarch64_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + aarch64_breakpoint::bp_from_kind); set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); set_gdbarch_software_single_step (gdbarch, aarch64_software_single_step); diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 58e6ee3..4b5c32d 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -646,9 +646,9 @@ alpha_return_in_memory_always (struct type *type) } -static const gdb_byte break_insn[] = { 0x80, 0, 0, 0 }; /* call_pal bpt */ +constexpr gdb_byte alpha_break_insn[] = { 0x80, 0, 0, 0 }; /* call_pal bpt */ -GDBARCH_BREAKPOINT_MANIPULATION (alpha, break_insn) +typedef BP_MANIPULATION (alpha_break_insn) alpha_breakpoint; /* This returns the PC of the first insn after the prologue. @@ -1818,7 +1818,10 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - SET_GDBARCH_BREAKPOINT_MANIPULATION (alpha); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + alpha_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + alpha_breakpoint::bp_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, ALPHA_INSN_SIZE); set_gdbarch_cannot_step_breakpoint (gdbarch, 1); diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index f310da9..e7a7d53 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -1235,7 +1235,8 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, arc_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (arc); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, arc_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, arc_sw_breakpoint_from_kind); /* On ARC 600 BRK_S instruction advances PC, unlike other ARC cores. */ if (!arc_mach_is_arc600 (gdbarch)) diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 9592580..830ebed 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -26,48 +26,51 @@ struct minimal_symbol; struct type; struct gdbarch_info; -#define GDBARCH_BREAKPOINT_MANIPULATION(ARCH,BREAK_INSN) \ - static int \ - ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch, \ - CORE_ADDR *pcptr) \ - { \ - return sizeof (BREAK_INSN); \ - } \ - static const gdb_byte * \ - ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch, \ - int kind, int *size) \ - { \ - *size = kind; \ - return BREAK_INSN; \ +template <size_t bp_size, const gdb_byte *break_insn> +struct bp_manipulation +{ + static int + kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr) + { + return bp_size; } -#define SET_GDBARCH_BREAKPOINT_MANIPULATION(ARCH) \ - set_gdbarch_breakpoint_kind_from_pc (gdbarch, \ - ARCH##_breakpoint_kind_from_pc); \ - set_gdbarch_sw_breakpoint_from_kind (gdbarch, \ - ARCH##_sw_breakpoint_from_kind) - -#define GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN(ARCH, \ - LITTLE_BREAK_INSN, \ - BIG_BREAK_INSN) \ - static int \ - ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch, \ - CORE_ADDR *pcptr) \ - { \ - gdb_static_assert (ARRAY_SIZE (LITTLE_BREAK_INSN) \ - == ARRAY_SIZE (BIG_BREAK_INSN)); \ - return sizeof (BIG_BREAK_INSN); \ - } \ - static const gdb_byte * \ - ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch, \ - int kind, int *size) \ - { \ - *size = kind; \ - if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \ - return BIG_BREAK_INSN; \ - else \ - return LITTLE_BREAK_INSN; \ + static const gdb_byte * + bp_from_kind (struct gdbarch *gdbarch, int kind, int *size) + { + *size = kind; + return break_insn; } +}; + +template <size_t bp_size, + const gdb_byte *break_insn_little, + const gdb_byte *break_insn_big> +struct bp_manipulation_endian +{ + static int + kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr) + { + return bp_size; + } + + static const gdb_byte * + bp_from_kind (struct gdbarch *gdbarch, int kind, int *size) + { + *size = kind; + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) + return break_insn_big; + else + return break_insn_little; + } +}; + +#define BP_MANIPULATION(BREAK_INSN) \ + bp_manipulation<sizeof (BREAK_INSN), BREAK_INSN> + +#define BP_MANIPULATION_ENDIAN(BREAK_INSN_LITTLE, BREAK_INSN_BIG) \ + bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE), \ + BREAK_INSN_LITTLE, BREAK_INSN_BIG> /* An implementation of gdbarch_displaced_step_copy_insn for processors that don't need to modify the instruction before diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 4a89227..f41ad6d 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9447,7 +9447,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Breakpoint manipulation. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (arm); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, arm_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, arm_sw_breakpoint_from_kind); set_gdbarch_breakpoint_kind_from_current_state (gdbarch, arm_breakpoint_kind_from_current_state); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 066bba4..11ec190 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -913,9 +913,9 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) it as a NOP. Thus, it should be ok. Since the avr is currently a remote only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */ -static const unsigned char avr_break_insn [] = { 0x98, 0x95 }; +constexpr gdb_byte avr_break_insn [] = { 0x98, 0x95 }; -GDBARCH_BREAKPOINT_MANIPULATION (avr, avr_break_insn) +typedef BP_MANIPULATION (avr_break_insn) avr_breakpoint; /* Determine, for architecture GDBARCH, how a return value of TYPE should be returned. If it is supposed to be returned in registers, @@ -1509,7 +1509,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (avr); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, avr_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, avr_breakpoint::bp_from_kind); frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind); frame_base_set_default (gdbarch, &avr_frame_base); diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index 989912e..c1886e0 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -830,7 +830,8 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_return_value (gdbarch, bfin_return_value); set_gdbarch_skip_prologue (gdbarch, bfin_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (bfin); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, bfin_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, bfin_sw_breakpoint_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, 2); set_gdbarch_frame_args_skip (gdbarch, 8); set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 3103f1c..1a2641b 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4127,7 +4127,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* The stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (cris); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind); set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc); set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 89d26d0..5c09b7a 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -424,9 +424,9 @@ frv_register_sim_regno (struct gdbarch *gdbarch, int reg) internal_error (__FILE__, __LINE__, _("Bad register number %d"), reg); } -static const unsigned char breakpoint[] = {0xc0, 0x70, 0x00, 0x01}; +constexpr gdb_byte frv_break_insn[] = {0xc0, 0x70, 0x00, 0x01}; -GDBARCH_BREAKPOINT_MANIPULATION (frv, breakpoint) +typedef BP_MANIPULATION (frv_break_insn) frv_breakpoint; /* Define the maximum number of instructions which may be packed into a bundle (VLIW instruction). */ @@ -1533,7 +1533,8 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue); set_gdbarch_skip_main_prologue (gdbarch, frv_skip_main_prologue); - SET_GDBARCH_BREAKPOINT_MANIPULATION (frv); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, frv_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, frv_breakpoint::bp_from_kind); set_gdbarch_adjust_breakpoint_address (gdbarch, frv_adjust_breakpoint_address); diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index bd907c4..0bb9a6f 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -79,9 +79,9 @@ ft32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) } -static const gdb_byte breakpoint[] = { 0x02, 0x00, 0x34, 0x00 }; +constexpr gdb_byte ft32_break_insn[] = { 0x02, 0x00, 0x34, 0x00 }; -GDBARCH_BREAKPOINT_MANIPULATION (ft32, breakpoint) +typedef BP_MANIPULATION (ft32_break_insn) ft32_breakpoint; /* FT32 register names. */ @@ -624,7 +624,8 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, ft32_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (ft32); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, ft32_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, ft32_breakpoint::bp_from_kind); set_gdbarch_frame_align (gdbarch, ft32_frame_align); frame_base_set_default (gdbarch, &ft32_frame_base); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 5e757a9..6a01110 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1243,9 +1243,9 @@ h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno) } /*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */ -static const unsigned char breakpoint[] = { 0x01, 0x80 }; /* Sleep */ +constexpr gdb_byte h8300_break_insn[] = { 0x01, 0x80 }; /* Sleep */ -GDBARCH_BREAKPOINT_MANIPULATION (h8300, breakpoint) +typedef BP_MANIPULATION (h8300_break_insn) h8300_breakpoint; static struct gdbarch * h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -1371,7 +1371,10 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows up. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (h8300); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + h8300_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + h8300_breakpoint::bp_from_kind); set_gdbarch_push_dummy_call (gdbarch, h8300_push_dummy_call); set_gdbarch_char_signed (gdbarch, 0); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 4fef5e7..4bb49ed 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -604,9 +604,9 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -static const unsigned char breakpoint[] = {0x00, 0x01, 0x00, 0x04}; +constexpr gdb_byte hppa_break_insn[] = {0x00, 0x01, 0x00, 0x04}; -GDBARCH_BREAKPOINT_MANIPULATION (hppa, breakpoint) +typedef BP_MANIPULATION (hppa_break_insn) hppa_breakpoint; /* Return the name of a register. */ @@ -3182,7 +3182,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) internal_error (__FILE__, __LINE__, _("bad switch")); } - SET_GDBARCH_BREAKPOINT_MANIPULATION (hppa); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, hppa_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, hppa_breakpoint::bp_from_kind); set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read); /* Frame unwind methods. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 697edc6..a67eca0 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -588,9 +588,10 @@ static const char *disassembly_flavor = att_flavor; This function is 64-bit safe. */ -static const gdb_byte break_insn[] = { 0xcc }; /* int 3 */ +constexpr gdb_byte i386_break_insn[] = { 0xcc }; /* int 3 */ + +typedef BP_MANIPULATION (i386_break_insn) i386_breakpoint; -GDBARCH_BREAKPOINT_MANIPULATION (i386, break_insn) /* Displaced instruction handling. */ @@ -8453,7 +8454,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (i386); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, i386_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, i386_breakpoint::bp_from_kind); + set_gdbarch_decr_pc_after_break (gdbarch, 1); set_gdbarch_max_insn_length (gdbarch, I386_MAX_INSN_LEN); diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index 874fc6a..a790a1b 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -831,7 +831,10 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_double_format (gdbarch, floatformats_ieee_double); set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); set_gdbarch_return_value (gdbarch, iq2000_return_value); - SET_GDBARCH_BREAKPOINT_MANIPULATION (iq2000); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + iq2000_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + iq2000_sw_breakpoint_from_kind); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index 89f13e0..e1b2582 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -216,9 +216,9 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) } /* Create a breakpoint instruction. */ -static const gdb_byte breakpoint[4] = { OP_RAISE << 2, 0, 0, 2 }; +constexpr gdb_byte lm32_break_insn[4] = { OP_RAISE << 2, 0, 0, 2 }; -GDBARCH_BREAKPOINT_MANIPULATION (lm32, breakpoint) +typedef BP_MANIPULATION (lm32_break_insn) lm32_breakpoint; /* Setup registers and stack for faking a call to a function in the @@ -557,7 +557,8 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind); /* Breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (lm32); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, lm32_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, lm32_breakpoint::bp_from_kind); set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); /* Calling functions in the inferior. */ diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index da99eae..429fecc 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -990,9 +990,9 @@ make_regs (struct gdbarch *arch) /* Breakpoints. */ -static const unsigned char break_insn[] = { 0x00 }; /* brk */ +constexpr gdb_byte m32c_break_insn[] = { 0x00 }; /* brk */ -GDBARCH_BREAKPOINT_MANIPULATION (m32c, break_insn) +typedef BP_MANIPULATION (m32c_break_insn) m32c_breakpoint; /* Prologue analysis. */ @@ -2645,7 +2645,8 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, print_insn_m32c); /* Breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (m32c); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, m32c_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, m32c_breakpoint::bp_from_kind); /* Prologue analysis and unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index c493e2d..31ea3ed 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -922,7 +922,8 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (m32r); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, m32r_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, m32r_sw_breakpoint_from_kind); set_gdbarch_memory_insert_breakpoint (gdbarch, m32r_memory_insert_breakpoint); set_gdbarch_memory_remove_breakpoint (gdbarch, diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 620d1fb..eb80946 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -390,9 +390,9 @@ m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr) return m68hc11_register_names[reg_nr]; } -static unsigned char breakpoint[] = {0x0}; +constexpr gdb_byte m68hc11_break_insn[] = {0x0}; -GDBARCH_BREAKPOINT_MANIPULATION (m68hc11, breakpoint) +typedef BP_MANIPULATION (m68hc11_break_insn) m68hc11_breakpoint; /* 68HC11 & 68HC12 prologue analysis. */ @@ -1521,7 +1521,10 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_return_value (gdbarch, m68hc11_return_value); set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (m68hc11); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + m68hc11_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + m68hc11_breakpoint::bp_from_kind); set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11); m68hc11_add_reggroups (gdbarch); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index cea2f01..53d0ade 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -57,9 +57,9 @@ #define BPT_VECTOR 0xf #endif -static gdb_byte break_insn[] = {0x4e, (0x40 | BPT_VECTOR)}; +constexpr gdb_byte m68k_break_insn[] = {0x4e, (0x40 | BPT_VECTOR)}; -GDBARCH_BREAKPOINT_MANIPULATION (m68k, break_insn) +typedef BP_MANIPULATION (m68k_break_insn) m68k_breakpoint; /* Construct types for ISA-specific registers. */ @@ -1191,7 +1191,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_bit (gdbarch, long_double_format[0]->totalsize); set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue); - SET_GDBARCH_BREAKPOINT_MANIPULATION (m68k); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, m68k_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, m68k_breakpoint::bp_from_kind); /* Stack grows down. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 48deb53..fbe5c5a 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -99,9 +99,9 @@ m88k_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) location for inserting the breakpoint. */ /* tb 0,r0,511 */ -static gdb_byte break_insn[] = { 0xf0, 0x00, 0xd1, 0xff }; +constexpr gdb_byte m88k_break_insn[] = { 0xf0, 0x00, 0xd1, 0xff }; -GDBARCH_BREAKPOINT_MANIPULATION (m88k, break_insn) +typedef BP_MANIPULATION (m88k_break_insn) m88k_breakpoint; static CORE_ADDR m88k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) @@ -852,7 +852,8 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_return_value (gdbarch, m88k_return_value); set_gdbarch_addr_bits_remove (gdbarch, m88k_addr_bits_remove); - SET_GDBARCH_BREAKPOINT_MANIPULATION (m88k); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, m88k_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, m88k_breakpoint::bp_from_kind); set_gdbarch_unwind_pc (gdbarch, m88k_unwind_pc); set_gdbarch_write_pc (gdbarch, m88k_write_pc); diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index a8900f1..80d2b76 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1918,9 +1918,9 @@ mep_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Breakpoints. */ -static unsigned char breakpoint[] = { 0x70, 0x32 }; +constexpr gdb_byte mep_break_insn[] = { 0x70, 0x32 }; -GDBARCH_BREAKPOINT_MANIPULATION (mep, breakpoint) +typedef BP_MANIPULATION (mep_break_insn) mep_breakpoint; /* Frames and frame unwinding. */ @@ -2484,7 +2484,8 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, mep_gdb_print_insn); /* Breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (mep); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, mep_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, mep_breakpoint::bp_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue); diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index ea33ae7..6dd5b42 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -134,9 +134,9 @@ microblaze_fetch_instruction (CORE_ADDR pc) return extract_unsigned_integer (buf, 4, byte_order); } -static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT; +constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; -GDBARCH_BREAKPOINT_MANIPULATION (microblaze, break_insn) +typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; /* Allocate and initialize a frame cache. */ @@ -731,7 +731,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (microblaze); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + microblaze_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + microblaze_breakpoint::bp_from_kind); set_gdbarch_frame_args_skip (gdbarch, 8); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 9eb2de1..da4bef6 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -8717,7 +8717,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_value_to_register (gdbarch, mips_value_to_register); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (mips); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, mips_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, mips_sw_breakpoint_from_kind); set_gdbarch_adjust_breakpoint_address (gdbarch, mips_adjust_breakpoint_address); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 16c0b39..542ef40 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -322,9 +322,9 @@ mn10300_write_pc (struct regcache *regcache, CORE_ADDR val) The Matsushita mn10x00 processors have single byte instructions so we need a single byte breakpoint. Matsushita hasn't defined one, so we defined it ourselves. */ -static gdb_byte breakpoint[] = {0xff}; +constexpr gdb_byte mn10300_break_insn[] = {0xff}; -GDBARCH_BREAKPOINT_MANIPULATION (mn10300, breakpoint) +typedef BP_MANIPULATION (mn10300_break_insn) mn10300_breakpoint; /* Model the semantics of pushing a register onto the stack. This is a helper function for mn10300_analyze_prologue, below. */ @@ -1438,7 +1438,10 @@ mn10300_gdbarch_init (struct gdbarch_info info, /* Stack unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (mn10300); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + mn10300_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + mn10300_breakpoint::bp_from_kind); /* decr_pc_after_break? */ /* Disassembly. */ set_gdbarch_print_insn (gdbarch, print_insn_mn10300); diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 8d29bdf..aadb270 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -68,9 +68,9 @@ moxie_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) return sp & ~1; } -static unsigned char breakpoint[] = { 0x35, 0x00 }; +constexpr gdb_byte moxie_break_insn[] = { 0x35, 0x00 }; -GDBARCH_BREAKPOINT_MANIPULATION (moxie, breakpoint) +typedef BP_MANIPULATION (moxie_break_insn) moxie_breakpoint; /* Moxie register names. */ @@ -1131,7 +1131,10 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, moxie_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (moxie); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + moxie_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + moxie_breakpoint::bp_from_kind); set_gdbarch_frame_align (gdbarch, moxie_frame_align); frame_base_set_default (gdbarch, &moxie_frame_base); diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 8043155..f37aa48 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -277,9 +277,9 @@ msp430_register_sim_regno (struct gdbarch *gdbarch, int regnum) return regnum; } -static gdb_byte breakpoint[] = { 0x43, 0x43 }; +constexpr gdb_byte msp430_break_insn[] = { 0x43, 0x43 }; -GDBARCH_BREAKPOINT_MANIPULATION (msp430, breakpoint) +typedef BP_MANIPULATION (msp430_break_insn) msp430_breakpoint; /* Define a "handle" struct for fetching the next opcode. */ @@ -993,7 +993,10 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); /* Breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (msp430); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + msp430_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + msp430_breakpoint::bp_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, 1); /* Disassembly. */ diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index a34023f..95dd681 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -1171,7 +1171,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_write (gdbarch, mt_pseudo_register_write); set_gdbarch_skip_prologue (gdbarch, mt_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (mt); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, mt_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, mt_sw_breakpoint_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_print_insn (gdbarch, print_insn_mt); diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index 618a482..43c54cc 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -282,9 +282,9 @@ nds32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) } /* The same insn machine code is used for little-endian and big-endian. */ -static const gdb_byte break_insn[] = { 0xEA, 0x00 }; +constexpr gdb_byte nds32_break_insn[] = { 0xEA, 0x00 }; -GDBARCH_BREAKPOINT_MANIPULATION (nds32, break_insn) +typedef BP_MANIPULATION (nds32_break_insn) nds32_breakpoint; /* Implement the "dwarf2_reg_to_regnum" gdbarch method. */ @@ -2143,7 +2143,10 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, nds32_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (nds32); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + nds32_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + nds32_breakpoint::bp_from_kind); set_gdbarch_frame_align (gdbarch, nds32_frame_align); frame_base_set_default (gdbarch, &nds32_frame_base); diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 97b422a..2955a69 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -2336,7 +2336,8 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, nios2_skip_prologue); set_gdbarch_stack_frame_destroyed_p (gdbarch, nios2_stack_frame_destroyed_p); - SET_GDBARCH_BREAKPOINT_MANIPULATION (nios2); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, nios2_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind); set_gdbarch_dummy_id (gdbarch, nios2_dummy_id); set_gdbarch_unwind_pc (gdbarch, nios2_unwind_pc); diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index 1e9d435..95a26a5 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -772,9 +772,9 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch, {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. */ @@ -1452,7 +1452,8 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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. */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 7cb7a9e..1588679 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -967,11 +967,11 @@ rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, /* Sequence of bytes for breakpoint instruction. */ -static unsigned char big_breakpoint[] = { 0x7d, 0x82, 0x10, 0x08 }; -static unsigned char little_breakpoint[] = { 0x08, 0x10, 0x82, 0x7d }; +constexpr gdb_byte big_breakpoint[] = { 0x7d, 0x82, 0x10, 0x08 }; +constexpr gdb_byte little_breakpoint[] = { 0x08, 0x10, 0x82, 0x7d }; -GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN (rs6000, little_breakpoint, - big_breakpoint) +typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint) + rs6000_breakpoint; /* Instruction masks for displaced stepping. */ #define BRANCH_MASK 0xfc000000 @@ -6479,7 +6479,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_main_prologue (gdbarch, rs6000_skip_main_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (rs6000); + + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + rs6000_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + rs6000_breakpoint::bp_from_kind); /* The value of symbols of type N_SO and N_FUN maybe null when it shouldn't be. */ diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c index fa91af9..6b8d8d5 100644 --- a/gdb/rx-tdep.c +++ b/gdb/rx-tdep.c @@ -992,9 +992,9 @@ rx_return_value (struct gdbarch *gdbarch, return RETURN_VALUE_REGISTER_CONVENTION; } -static gdb_byte breakpoint[] = { 0x00 }; +constexpr gdb_byte rx_break_insn[] = { 0x00 }; -GDBARCH_BREAKPOINT_MANIPULATION (rx, breakpoint) +typedef BP_MANIPULATION (rx_break_insn) rx_breakpoint; /* Implement the dwarf_reg_to_regnum" gdbarch method. */ @@ -1092,7 +1092,8 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_sp_regnum (gdbarch, RX_SP_REGNUM); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_decr_pc_after_break (gdbarch, 1); - SET_GDBARCH_BREAKPOINT_MANIPULATION (rx); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, rx_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind); set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue); set_gdbarch_print_insn (gdbarch, print_insn_rx); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index f654e25..57bb992 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -3550,9 +3550,9 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function, /* Breakpoints. */ -static const gdb_byte breakpoint[] = { 0x0, 0x1 }; +constexpr gdb_byte s390_break_insn[] = { 0x0, 0x1 }; -GDBARCH_BREAKPOINT_MANIPULATION (s390, breakpoint) +typedef BP_MANIPULATION (s390_break_insn) s390_breakpoint; /* Address handling. */ @@ -7975,7 +7975,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_decr_pc_after_break (gdbarch, 2); /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (s390); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, s390_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, s390_breakpoint::bp_from_kind); set_gdbarch_software_single_step (gdbarch, s390_software_single_step); set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep); set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue); diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index 1bba20b..becea6b 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -1496,7 +1496,10 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) switch (target_mach) { case bfd_mach_score7: - SET_GDBARCH_BREAKPOINT_MANIPULATION (score7); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + score7_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + score7_sw_breakpoint_from_kind); set_gdbarch_skip_prologue (gdbarch, score7_skip_prologue); set_gdbarch_stack_frame_destroyed_p (gdbarch, score7_stack_frame_destroyed_p); @@ -1508,7 +1511,10 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; case bfd_mach_score3: - SET_GDBARCH_BREAKPOINT_MANIPULATION (score3); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + score3_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + score3_sw_breakpoint_from_kind); set_gdbarch_skip_prologue (gdbarch, score3_skip_prologue); set_gdbarch_stack_frame_destroyed_p (gdbarch, score3_stack_frame_destroyed_p); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 27795ba..01a2401 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2282,7 +2282,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_type (gdbarch, sh_default_register_type); set_gdbarch_register_reggroup_p (gdbarch, sh_register_reggroup_p); - SET_GDBARCH_BREAKPOINT_MANIPULATION (sh); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, sh_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, sh_sw_breakpoint_from_kind); set_gdbarch_print_insn (gdbarch, print_insn_sh); set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno); diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 80df8b9..cbbefdd 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -2411,7 +2411,8 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write); - SET_GDBARCH_BREAKPOINT_MANIPULATION (sh64); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, sh64_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, sh64_sw_breakpoint_from_kind); set_gdbarch_print_insn (gdbarch, print_insn_sh); set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index abeec80..d50d874 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -641,9 +641,9 @@ sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, encode a breakpoint instruction, store the length of the string in *LEN and optionally adjust *PC to point to the correct memory location for inserting the breakpoint. */ -static const gdb_byte break_insn[] = { 0x91, 0xd0, 0x20, 0x01 }; +constexpr gdb_byte sparc_break_insn[] = { 0x91, 0xd0, 0x20, 0x01 }; -GDBARCH_BREAKPOINT_MANIPULATION (sparc, break_insn) +typedef BP_MANIPULATION (sparc_break_insn) sparc_breakpoint; /* Allocate and initialize a frame cache. */ @@ -1703,7 +1703,10 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (sparc); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + sparc_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + sparc_breakpoint::bp_from_kind); set_gdbarch_frame_args_skip (gdbarch, 8); diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 1863da1..308c460 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1570,9 +1570,9 @@ spu_return_value (struct gdbarch *gdbarch, struct value *function, /* Breakpoints. */ -static const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff }; +constexpr gdb_byte spu_break_insn[] = { 0x00, 0x00, 0x3f, 0xff }; -GDBARCH_BREAKPOINT_MANIPULATION (spu, breakpoint) +typedef BP_MANIPULATION (spu_break_insn) spu_breakpoint; static int spu_memory_remove_breakpoint (struct gdbarch *gdbarch, @@ -2790,7 +2790,8 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Breakpoints. */ set_gdbarch_decr_pc_after_break (gdbarch, 4); - SET_GDBARCH_BREAKPOINT_MANIPULATION (spu); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, spu_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, spu_breakpoint::bp_from_kind); set_gdbarch_memory_remove_breakpoint (gdbarch, spu_memory_remove_breakpoint); set_gdbarch_software_single_step (gdbarch, spu_software_single_step); set_gdbarch_get_longjmp_target (gdbarch, spu_get_longjmp_target); diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c index d278e80..63be761 100644 --- a/gdb/tic6x-tdep.c +++ b/gdb/tic6x-tdep.c @@ -1302,7 +1302,10 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_skip_prologue (gdbarch, tic6x_skip_prologue); - SET_GDBARCH_BREAKPOINT_MANIPULATION (tic6x); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + tic6x_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + tic6x_sw_breakpoint_from_kind); set_gdbarch_unwind_pc (gdbarch, tic6x_unwind_pc); set_gdbarch_unwind_sp (gdbarch, tic6x_unwind_sp); diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index ea03688..9cc2c2c 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -843,10 +843,10 @@ tilegx_write_pc (struct regcache *regcache, CORE_ADDR pc) } /* 64-bit pattern for a { bpt ; nop } bundle. */ -static const unsigned char breakpoint[] = +constexpr gdb_byte tilegx_break_insn[] = { 0x00, 0x50, 0x48, 0x51, 0xae, 0x44, 0x6a, 0x28 }; -GDBARCH_BREAKPOINT_MANIPULATION (tilegx, breakpoint) +typedef BP_MANIPULATION (tilegx_break_insn) tilegx_breakpoint; /* Normal frames. */ @@ -1049,7 +1049,10 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_dummy_call (gdbarch, tilegx_push_dummy_call); set_gdbarch_get_longjmp_target (gdbarch, tilegx_get_longjmp_target); set_gdbarch_write_pc (gdbarch, tilegx_write_pc); - SET_GDBARCH_BREAKPOINT_MANIPULATION (tilegx); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + tilegx_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + tilegx_breakpoint::bp_from_kind); set_gdbarch_return_value (gdbarch, tilegx_return_value); set_gdbarch_print_insn (gdbarch, print_insn_tilegx); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 27e67a4..d69ee32 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1457,7 +1457,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - SET_GDBARCH_BREAKPOINT_MANIPULATION (v850); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, v850_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, v850_sw_breakpoint_from_kind); set_gdbarch_return_value (gdbarch, v850_return_value); set_gdbarch_push_dummy_call (gdbarch, v850_push_dummy_call); set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue); diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 861f807..9c562f1 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -252,9 +252,9 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, *LEN and optionally adjust *PC to point to the correct memory location for inserting the breakpoint. */ -static gdb_byte break_insn[] = { 3 }; +constexpr gdb_byte vax_break_insn[] = { 3 }; -GDBARCH_BREAKPOINT_MANIPULATION (vax, break_insn) +typedef BP_MANIPULATION (vax_break_insn) vax_breakpoint; /* Advance PC across any function entry prologue instructions to reach some "real" code. */ @@ -495,7 +495,8 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dummy_id (gdbarch, vax_dummy_id); /* Breakpoint info */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (vax); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, vax_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, vax_breakpoint::bp_from_kind); /* Misc info */ set_gdbarch_deprecated_function_start_offset (gdbarch, 2); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index b2f0c5e..819e2ae 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -506,9 +506,9 @@ xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -static unsigned char breakpoint[] = { 0x06, 0x0 }; +constexpr gdb_byte xstormy16_break_insn[] = { 0x06, 0x0 }; -GDBARCH_BREAKPOINT_MANIPULATION (xstormy16, breakpoint) +typedef BP_MANIPULATION (xstormy16_break_insn) xstormy16_breakpoint; /* Given a pointer to a jump table entry, return the address of the function it jumps to. Return 0 if not found. */ @@ -838,7 +838,10 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* These values and methods are used when gdb calls a target function. */ set_gdbarch_push_dummy_call (gdbarch, xstormy16_push_dummy_call); - SET_GDBARCH_BREAKPOINT_MANIPULATION (xstormy16); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + xstormy16_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + xstormy16_breakpoint::bp_from_kind); set_gdbarch_return_value (gdbarch, xstormy16_return_value); set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code); diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 8eef5cb..783f71d 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -3240,7 +3240,10 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Set breakpoints. */ - SET_GDBARCH_BREAKPOINT_MANIPULATION (xtensa); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, + xtensa_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + xtensa_sw_breakpoint_from_kind); /* After breakpoint instruction or illegal instruction, pc still points at break instruction, so don't decrement. */ |