From 04180708eff91ddd3a9572bd4b517ccce5850db0 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 3 Nov 2016 14:35:14 +0000 Subject: [PATCH] Remove GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION Both of them are used in conversion. We can remove them since the conversion is done. There are many architectures only have one breakpoint instruction, so their gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind look very similar. Instead of macro, we use template "template struct bp_manipulation" for these architectures. In order to use template, I also change breakpoint instruction of type "static const gdb_byte[]" to "constexpr gdb_byte[]", and rename them to ARCH_break_insn. gdb: 2016-11-03 Yao Qi Pedro Alves * 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. --- gdb/ChangeLog | 157 ++++++++++++++++++++++++++++++++++++++++++ gdb/aarch64-tdep.c | 9 ++- gdb/alpha-tdep.c | 9 ++- gdb/arc-tdep.c | 3 +- gdb/arch-utils.h | 81 +++++++++++----------- gdb/arm-tdep.c | 3 +- gdb/avr-tdep.c | 7 +- gdb/bfin-tdep.c | 3 +- gdb/cris-tdep.c | 3 +- gdb/frv-tdep.c | 7 +- gdb/ft32-tdep.c | 7 +- gdb/h8300-tdep.c | 9 ++- gdb/hppa-tdep.c | 7 +- gdb/i386-tdep.c | 9 ++- gdb/iq2000-tdep.c | 5 +- gdb/lm32-tdep.c | 7 +- gdb/m32c-tdep.c | 7 +- gdb/m32r-tdep.c | 3 +- gdb/m68hc11-tdep.c | 9 ++- gdb/m68k-tdep.c | 7 +- gdb/m88k-tdep.c | 7 +- gdb/mep-tdep.c | 7 +- gdb/microblaze-tdep.c | 9 ++- gdb/mips-tdep.c | 3 +- gdb/mn10300-tdep.c | 9 ++- gdb/moxie-tdep.c | 9 ++- gdb/msp430-tdep.c | 9 ++- gdb/mt-tdep.c | 3 +- gdb/nds32-tdep.c | 9 ++- gdb/nios2-tdep.c | 3 +- gdb/rl78-tdep.c | 7 +- gdb/rs6000-tdep.c | 14 ++-- gdb/rx-tdep.c | 7 +- gdb/s390-linux-tdep.c | 7 +- gdb/score-tdep.c | 10 ++- gdb/sh-tdep.c | 3 +- gdb/sh64-tdep.c | 3 +- gdb/sparc-tdep.c | 9 ++- gdb/spu-tdep.c | 7 +- gdb/tic6x-tdep.c | 5 +- gdb/tilegx-tdep.c | 9 ++- gdb/v850-tdep.c | 3 +- gdb/vax-tdep.c | 7 +- gdb/xstormy16-tdep.c | 9 ++- gdb/xtensa-tdep.c | 5 +- 45 files changed, 384 insertions(+), 141 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b9b43d75863..c1339517e07 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,160 @@ +2016-11-03 Yao Qi + Pedro Alves + + * 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 * arm-tdep.c (arm_override_mode): Remove. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 304d9df7e84..1298302ab43 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 58e6ee323f6..4b5c32db666 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 f310da9c866..e7a7d53f6f7 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 9592580d79b..830ebed3120 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 +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 +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 + +#define BP_MANIPULATION_ENDIAN(BREAK_INSN_LITTLE, BREAK_INSN_BIG) \ + bp_manipulation_endian /* 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 4a8922738c3..f41ad6daf76 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 066bba40826..11ec1905547 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 989912e911c..c1886e088d0 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 3103f1c7e6a..1a2641b085d 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 89d26d0f1b8..5c09b7a628f 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 bd907c4073f..0bb9a6f191c 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 5e757a934dd..6a011103e48 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 4fef5e7828c..4bb49ed2ef6 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 697edc6c8b5..a67eca00164 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 874fc6a8bfd..a790a1b36f8 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 89f13e0386b..e1b2582c1ff 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 da99eaec42f..429fecce078 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 c493e2d53a8..31ea3ed4eaf 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 620d1fb2c78..eb809460518 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 cea2f018cd6..53d0adefc19 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 48deb53af9d..fbe5c5a2e8d 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 a8900f1aded..80d2b76bce2 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 ea33ae7dfcb..6dd5b42a7f5 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 9eb2de15d4e..da4bef6f829 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 16c0b392cad..542ef407623 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 8d29bdfe2e9..aadb2701859 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 8043155d534..f37aa48e53c 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 a34023f0f47..95dd6816a79 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 618a4827dac..43c54ccdf19 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 97b422a7055..2955a69dc32 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 1e9d4358978..95a26a5124a 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 7cb7a9ea612..15886797bb9 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 fa91af933c3..6b8d8d5d604 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 f654e25f791..57bb9923462 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 1bba20b87d4..becea6b5ce9 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 27795ba0134..01a24010514 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 80df8b9aafc..cbbefddfe51 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 abeec802853..d50d874760f 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 1863da1048e..308c4604dce 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 d278e80d806..63be7616b77 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 ea0368890d0..9cc2c2c5f55 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 27e67a49cb1..d69ee329828 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 861f807516f..9c562f13b5e 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 b2f0c5eaeb3..819e2aea85e 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 8eef5cb9c43..783f71d04e7 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. */ -- 2.30.2