From 3ca4edb6617353defacd3bf3a4ee3d458238419e Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Thu, 2 Apr 2020 15:11:25 +0200 Subject: [PATCH] gdbserver/linux-low: turn 'sw_breakpoint_from_kind' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur Remove the 'sw_breakpoint_from_kind' linux target op, and let the concrete linux target define it by overriding the op in process_stratum_target. * linux-low.cc (linux_process_target::sw_breakpoint_from_kind): Remove. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Remove. * linux-x86-low.cc (class x86_target) : Declare. (x86_sw_breakpoint_from_kind): Turn into... (x86_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_sw_breakpoint_from_kind): Turn into... (aarch64_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) : Declare. (arm_target::sw_breakpoint_from_kind): Define. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) : Declare. (bfin_sw_breakpoint_from_kind): Turn into... (bfin_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) : Declare. (cris_sw_breakpoint_from_kind): Turn into... (cris_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) : Declare. (cris_sw_breakpoint_from_kind): Turn into... (crisv32_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) : Declare. (ia64_target::sw_breakpoint_from_kind): Define. * linux-m32r-low.cc (class m32r_target) : Declare. (m32r_sw_breakpoint_from_kind): Turn into... (m32r_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) : Declare. (m68k_sw_breakpoint_from_kind): Turn into... (m68k_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) : Declare. (mips_sw_breakpoint_from_kind): Turn into... (mips_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-nios2-low.cc (class nios2_target) : Declare. (nios2_sw_breakpoint_from_kind): Turn into... (nios2_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) : Declare. (ppc_sw_breakpoint_from_kind): Turn into... (ppc_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) : Declare. (riscv_sw_breakpoint_from_kind): Turn into... (riscv_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) : Declare. (s390_sw_breakpoint_from_kind): Turn into... (s390_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-sh-low.cc (class sh_target) : Declare. (sh_sw_breakpoint_from_kind): Turn into... (sh_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) : Declare. (sparc_sw_breakpoint_from_kind): Turn into... (sparc_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) : Declare. (tic6x_sw_breakpoint_from_kind): Turn into... (tic6x_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) : Declare. (tile_sw_breakpoint_from_kind): Turn into... (tile_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) : Declare. (xtensa_sw_breakpoint_from_kind): Turn into... (xtensa_target::sw_breakpoint_from_kind): ...this. (the_low_target): Remove the op field. --- gdbserver/ChangeLog | 103 +++++++++++++++++++++++++++++++++ gdbserver/linux-aarch64-low.cc | 9 +-- gdbserver/linux-arm-low.cc | 9 ++- gdbserver/linux-bfin-low.cc | 9 +-- gdbserver/linux-cris-low.cc | 9 +-- gdbserver/linux-crisv32-low.cc | 9 +-- gdbserver/linux-ia64-low.cc | 9 +++ gdbserver/linux-low.cc | 10 ---- gdbserver/linux-low.h | 5 -- gdbserver/linux-m32r-low.cc | 9 +-- gdbserver/linux-m68k-low.cc | 9 +-- gdbserver/linux-mips-low.cc | 9 +-- gdbserver/linux-nios2-low.cc | 9 +-- gdbserver/linux-ppc-low.cc | 9 +-- gdbserver/linux-riscv-low.cc | 9 +-- gdbserver/linux-s390-low.cc | 9 +-- gdbserver/linux-sh-low.cc | 9 +-- gdbserver/linux-sparc-low.cc | 9 +-- gdbserver/linux-tic6x-low.cc | 9 +-- gdbserver/linux-tile-low.cc | 9 +-- gdbserver/linux-x86-low.cc | 9 +-- gdbserver/linux-xtensa-low.cc | 9 +-- 22 files changed, 205 insertions(+), 84 deletions(-) diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index d81641cc19..77c766d805 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,106 @@ +2020-04-02 Tankut Baris Aktemur + + Remove the 'sw_breakpoint_from_kind' linux target op, and let + the concrete linux target define it by overriding the op + in process_stratum_target. + + * linux-low.cc (linux_process_target::sw_breakpoint_from_kind): + Remove. + * linux-low.h (struct linux_target_ops): Remove the op. + (class linux_process_target) : Remove. + * linux-x86-low.cc (class x86_target) : + Declare. + (x86_sw_breakpoint_from_kind): Turn into... + (x86_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-aarch64-low.cc (class aarch64_target) + : Declare. + (aarch64_sw_breakpoint_from_kind): Turn into... + (aarch64_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-arm-low.cc (class arm_target) : + Declare. + (arm_target::sw_breakpoint_from_kind): Define. + (the_low_target): Remove the op field. + * linux-bfin-low.cc (class bfin_target) : + Declare. + (bfin_sw_breakpoint_from_kind): Turn into... + (bfin_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-cris-low.cc (class cris_target) : + Declare. + (cris_sw_breakpoint_from_kind): Turn into... + (cris_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-crisv32-low.cc (class crisv32_target) + : Declare. + (cris_sw_breakpoint_from_kind): Turn into... + (crisv32_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-ia64-low.cc (class ia64_target) : + Declare. + (ia64_target::sw_breakpoint_from_kind): Define. + * linux-m32r-low.cc (class m32r_target) : + Declare. + (m32r_sw_breakpoint_from_kind): Turn into... + (m32r_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-m68k-low.cc (class m68k_target) : + Declare. + (m68k_sw_breakpoint_from_kind): Turn into... + (m68k_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-mips-low.cc (class mips_target) : + Declare. + (mips_sw_breakpoint_from_kind): Turn into... + (mips_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-nios2-low.cc (class nios2_target) : + Declare. + (nios2_sw_breakpoint_from_kind): Turn into... + (nios2_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-ppc-low.cc (class ppc_target) : + Declare. + (ppc_sw_breakpoint_from_kind): Turn into... + (ppc_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-riscv-low.cc (class riscv_target) : + Declare. + (riscv_sw_breakpoint_from_kind): Turn into... + (riscv_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-s390-low.cc (class s390_target) : + Declare. + (s390_sw_breakpoint_from_kind): Turn into... + (s390_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-sh-low.cc (class sh_target) : + Declare. + (sh_sw_breakpoint_from_kind): Turn into... + (sh_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-sparc-low.cc (class sparc_target) : + Declare. + (sparc_sw_breakpoint_from_kind): Turn into... + (sparc_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-tic6x-low.cc (class tic6x_target) : + Declare. + (tic6x_sw_breakpoint_from_kind): Turn into... + (tic6x_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-tile-low.cc (class tile_target) : + Declare. + (tile_sw_breakpoint_from_kind): Turn into... + (tile_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + * linux-xtensa-low.cc (class xtensa_target) + : Declare. + (xtensa_sw_breakpoint_from_kind): Turn into... + (xtensa_target::sw_breakpoint_from_kind): ...this. + (the_low_target): Remove the op field. + 2020-04-02 Tankut Baris Aktemur Remove the 'breakpoint_kind_from_pc' and diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index c9c9b30b36..23c9c3e251 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -61,6 +61,8 @@ public: int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -3054,10 +3056,10 @@ aarch64_supports_range_stepping (void) return 1; } -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -aarch64_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +aarch64_target::sw_breakpoint_from_kind (int kind, int *size) { if (is_64bit_tdesc ()) { @@ -3101,7 +3103,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - aarch64_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, /* decr_pc_after_break */ aarch64_breakpoint_at, diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index d02ead70fa..aab2c427f5 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -66,6 +66,8 @@ public: int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -115,6 +117,12 @@ arm_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr) return arm_breakpoint_kind_from_current_state (pcptr); } +const gdb_byte * +arm_target::sw_breakpoint_from_kind (int kind, int *size) +{ + return arm_sw_breakpoint_from_kind (kind, size); +} + /* Information describing the hardware breakpoint capabilities. */ static struct { @@ -1067,7 +1075,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - arm_sw_breakpoint_from_kind, arm_gdbserver_get_next_pcs, 0, arm_breakpoint_at, diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index 1a0938ef58..c798c9317f 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -31,6 +31,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -102,10 +104,10 @@ bfin_target::low_cannot_fetch_register (int regno) #define bfin_breakpoint_len 2 static const gdb_byte bfin_breakpoint[bfin_breakpoint_len] = {0xa1, 0x00}; -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -bfin_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +bfin_target::sw_breakpoint_from_kind (int kind, int *size) { *size = bfin_breakpoint_len; return bfin_breakpoint; @@ -159,7 +161,6 @@ bfin_target::get_regs_info () } struct linux_target_ops the_low_target = { - bfin_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 2, bfin_breakpoint_at, diff --git a/gdbserver/linux-cris-low.cc b/gdbserver/linux-cris-low.cc index 882e4c61eb..a22ec3342d 100644 --- a/gdbserver/linux-cris-low.cc +++ b/gdbserver/linux-cris-low.cc @@ -28,6 +28,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -107,10 +109,10 @@ cris_target::low_cannot_fetch_register (int regno) static const unsigned short cris_breakpoint = 0xe938; #define cris_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -cris_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +cris_target::sw_breakpoint_from_kind (int kind, int *size) { *size = cris_breakpoint_len; return (const gdb_byte *) &cris_breakpoint; @@ -156,7 +158,6 @@ cris_target::get_regs_info () } struct linux_target_ops the_low_target = { - cris_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, cris_breakpoint_at, diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index 270c206e80..965f186981 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -28,6 +28,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -117,10 +119,10 @@ static int cris_regmap[] = { static const unsigned short cris_breakpoint = 0xe938; #define cris_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -cris_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +crisv32_target::sw_breakpoint_from_kind (int kind, int *size) { *size = cris_breakpoint_len; return (const gdb_byte *) &cris_breakpoint; @@ -453,7 +455,6 @@ crisv32_target::get_regs_info () } struct linux_target_ops the_low_target = { - cris_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, cris_breakpoint_at, diff --git a/gdbserver/linux-ia64-low.cc b/gdbserver/linux-ia64-low.cc index 377df4f75c..493c7e4f93 100644 --- a/gdbserver/linux-ia64-low.cc +++ b/gdbserver/linux-ia64-low.cc @@ -31,6 +31,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -46,6 +48,13 @@ protected: static ia64_target the_ia64_target; +const gdb_byte * +ia64_target::sw_breakpoint_from_kind (int kind, int *size) +{ + gdb_assert_no_reached ("target op sw_breakpoint_from_kind is not " + "implemented by this target"); +} + /* Defined in auto-generated file reg-ia64.c. */ void init_registers_ia64 (void); extern const struct target_desc *tdesc_ia64; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 730f23bb6f..14a4dbf086 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -7230,16 +7230,6 @@ current_lwp_ptid (void) return ptid_of (current_thread); } -/* Implementation of the target_ops method "sw_breakpoint_from_kind". */ - -const gdb_byte * -linux_process_target::sw_breakpoint_from_kind (int kind, int *size) -{ - gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL); - - return (*the_low_target.sw_breakpoint_from_kind) (kind, size); -} - const char * linux_process_target::thread_name (ptid_t thread) { diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 60ec910057..b2f779893e 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -131,9 +131,6 @@ struct lwp_info; struct linux_target_ops { - /* See target.h for details. */ - const gdb_byte *(*sw_breakpoint_from_kind) (int kind, int *size); - /* Find the next possible PCs after the current instruction executes. */ std::vector (*get_next_pcs) (struct regcache *regcache); @@ -436,8 +433,6 @@ public: ssize_t multifs_readlink (int pid, const char *filename, char *buf, size_t bufsiz) override; - const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; - const char *thread_name (ptid_t thread) override; #if USE_THREAD_DB diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index c7bb811e64..1a6771f584 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -31,6 +31,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -101,10 +103,10 @@ m32r_target::low_cannot_fetch_register (int regno) static const unsigned short m32r_breakpoint = 0x10f1; #define m32r_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -m32r_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +m32r_target::sw_breakpoint_from_kind (int kind, int *size) { *size = m32r_breakpoint_len; return (const gdb_byte *) &m32r_breakpoint; @@ -158,7 +160,6 @@ m32r_target::get_regs_info () } struct linux_target_ops the_low_target = { - m32r_sw_breakpoint_from_kind, NULL, 0, m32r_breakpoint_at, diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index 6483c27698..5e19ab0209 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -27,6 +27,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -170,10 +172,10 @@ static struct regset_info m68k_regsets[] = { static const gdb_byte m68k_breakpoint[] = { 0x4E, 0x4F }; #define m68k_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -m68k_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +m68k_target::sw_breakpoint_from_kind (int kind, int *size) { *size = m68k_breakpoint_len; return m68k_breakpoint; @@ -253,7 +255,6 @@ m68k_supports_hardware_single_step (void) } struct linux_target_ops the_low_target = { - m68k_sw_breakpoint_from_kind, NULL, 2, m68k_breakpoint_at, diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc index d36836669d..972f431bfb 100644 --- a/gdbserver/linux-mips-low.cc +++ b/gdbserver/linux-mips-low.cc @@ -33,6 +33,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -315,10 +317,10 @@ mips_target::low_set_pc (regcache *regcache, CORE_ADDR pc) static const unsigned int mips_breakpoint = 0x0005000d; #define mips_breakpoint_len 4 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -mips_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +mips_target::sw_breakpoint_from_kind (int kind, int *size) { *size = mips_breakpoint_len; return (const gdb_byte *) &mips_breakpoint; @@ -964,7 +966,6 @@ mips_target::get_regs_info () } struct linux_target_ops the_low_target = { - mips_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, mips_breakpoint_at, diff --git a/gdbserver/linux-nios2-low.cc b/gdbserver/linux-nios2-low.cc index 4f10df53d2..693af71f29 100644 --- a/gdbserver/linux-nios2-low.cc +++ b/gdbserver/linux-nios2-low.cc @@ -39,6 +39,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -152,10 +154,10 @@ nios2_target::low_cannot_store_register (int regno) static const unsigned int nios2_breakpoint = NIOS2_BREAKPOINT; #define nios2_breakpoint_len 4 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -nios2_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +nios2_target::sw_breakpoint_from_kind (int kind, int *size) { *size = nios2_breakpoint_len; return (const gdb_byte *) &nios2_breakpoint; @@ -275,7 +277,6 @@ nios2_target::get_regs_info () struct linux_target_ops the_low_target = { - nios2_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, nios2_breakpoint_at, diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 167c3b60f7..9690d79f3d 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -52,6 +52,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -296,10 +298,10 @@ static int ppc_regmap_adjusted; static const unsigned int ppc_breakpoint = 0x7d821008; #define ppc_breakpoint_len 4 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -ppc_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +ppc_target::sw_breakpoint_from_kind (int kind, int *size) { *size = ppc_breakpoint_len; return (const gdb_byte *) &ppc_breakpoint; @@ -3404,7 +3406,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - ppc_sw_breakpoint_from_kind, NULL, 0, ppc_breakpoint_at, diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc index 87266395e9..d6f31b4725 100644 --- a/gdbserver/linux-riscv-low.cc +++ b/gdbserver/linux-riscv-low.cc @@ -40,6 +40,8 @@ public: int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -266,10 +268,10 @@ riscv_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) return sizeof (riscv_cbreakpoint); } -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -riscv_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +riscv_target::sw_breakpoint_from_kind (int kind, int *size) { *size = kind; switch (kind) @@ -307,7 +309,6 @@ riscv_breakpoint_at (CORE_ADDR pc) /* RISC-V/Linux target operations. */ struct linux_target_ops the_low_target = { - riscv_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, /* decr_pc_after_break */ riscv_breakpoint_at, diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index 44f3be6c98..164142dff6 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -59,6 +59,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -451,10 +453,10 @@ static struct regset_info s390_regsets[] = { static const gdb_byte s390_breakpoint[] = { 0, 1 }; #define s390_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -s390_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +s390_target::sw_breakpoint_from_kind (int kind, int *size) { *size = s390_breakpoint_len; return s390_breakpoint; @@ -2824,7 +2826,6 @@ s390_emit_ops (void) } struct linux_target_ops the_low_target = { - s390_sw_breakpoint_from_kind, NULL, s390_breakpoint_len, s390_breakpoint_at, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index 36c1933475..10ee49a5f8 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -27,6 +27,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -107,10 +109,10 @@ sh_target::low_cannot_fetch_register (int regno) static const unsigned short sh_breakpoint = 0xc3c3; #define sh_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -sh_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +sh_target::sw_breakpoint_from_kind (int kind, int *size) { *size = sh_breakpoint_len; return (const gdb_byte *) &sh_breakpoint; @@ -188,7 +190,6 @@ sh_target::low_arch_setup () } struct linux_target_ops the_low_target = { - sh_sw_breakpoint_from_kind, NULL, 0, sh_breakpoint_at, diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc index 18a529adb7..c94c3e3caf 100644 --- a/gdbserver/linux-sparc-low.cc +++ b/gdbserver/linux-sparc-low.cc @@ -50,6 +50,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -267,10 +269,10 @@ static const gdb_byte sparc_breakpoint[INSN_SIZE] = { }; #define sparc_breakpoint_len INSN_SIZE -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const unsigned char * -sparc_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +sparc_target::sw_breakpoint_from_kind (int kind, int *size) { *size = sparc_breakpoint_len; return sparc_breakpoint; @@ -337,7 +339,6 @@ sparc_target::get_regs_info () } struct linux_target_ops the_low_target = { - sparc_sw_breakpoint_from_kind, NULL, /* get_next_pcs */ 0, sparc_breakpoint_at, diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index 1486829594..69bb4f3d7b 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -46,6 +46,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -202,10 +204,10 @@ static int *tic6x_regmap; static unsigned int tic6x_breakpoint; #define tic6x_breakpoint_len 4 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -tic6x_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +tic6x_target::sw_breakpoint_from_kind (int kind, int *size) { *size = tic6x_breakpoint_len; return (const gdb_byte *) &tic6x_breakpoint; @@ -419,7 +421,6 @@ tic6x_target::get_regs_info () } struct linux_target_ops the_low_target = { - tic6x_sw_breakpoint_from_kind, NULL, 0, tic6x_breakpoint_at, diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index d577b589b4..e4565b4cfb 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -31,6 +31,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -116,10 +118,10 @@ tile_target::low_cannot_store_register (int regno) static uint64_t tile_breakpoint = 0x400b3cae70166000ULL; #define tile_breakpoint_len 8 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -tile_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +tile_target::sw_breakpoint_from_kind (int kind, int *size) { *size = tile_breakpoint_len; return (const gdb_byte *) &tile_breakpoint; @@ -220,7 +222,6 @@ tile_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - tile_sw_breakpoint_from_kind, NULL, 0, tile_breakpoint_at, diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 1da48db302..a9d7ec0670 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -106,6 +106,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -2852,10 +2854,10 @@ x86_emit_ops (void) return &i386_emit_ops; } -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -x86_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +x86_target::sw_breakpoint_from_kind (int kind, int *size) { *size = x86_breakpoint_len; return x86_breakpoint; @@ -2897,7 +2899,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_sw_breakpoint_from_kind, NULL, 1, x86_breakpoint_at, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index 32643307cb..ab08227a86 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -28,6 +28,8 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + protected: void low_arch_setup () override; @@ -252,10 +254,10 @@ static struct regset_info xtensa_regsets[] = { static const gdb_byte xtensa_breakpoint[] = XTENSA_BREAKPOINT; #define xtensa_breakpoint_len 2 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -xtensa_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +xtensa_target::sw_breakpoint_from_kind (int kind, int *size) { *size = xtensa_breakpoint_len; return xtensa_breakpoint; @@ -326,7 +328,6 @@ xtensa_target::get_regs_info () } struct linux_target_ops the_low_target = { - xtensa_sw_breakpoint_from_kind, NULL, 0, xtensa_breakpoint_at, -- 2.34.1