From 47f70aa7685c0a7fad4ca76964a4199a5b5edd1c Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Thu, 2 Apr 2020 15:11:29 +0200 Subject: [PATCH] gdbserver/linux-low: turn 'supports_tracepoints' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur Remote the 'supports_tracepoints' linux target op and let the concrete linux target define it by overriding the op declared in process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Remove. * linux-low.cc (linux_process_target::supports_tracepoints): Remove. * linux-x86-low.cc (class x86_target) : Declare. (x86_supports_tracepoints): Turn into... (x86_target::supports_tracepoints): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_supports_tracepoints): Turn into... (aarch64_target::supports_tracepoints): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) : Declare. (ppc_supports_tracepoints): Turn into... (ppc_target::supports_tracepoints): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) : Declare. (s390_supports_tracepoints): Turn into... (s390_target::supports_tracepoints): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. --- gdbserver/ChangeLog | 39 ++++++++++++++++++++++++++++++++++ gdbserver/linux-aarch64-low.cc | 11 +++++----- gdbserver/linux-arm-low.cc | 1 - gdbserver/linux-bfin-low.cc | 1 - gdbserver/linux-crisv32-low.cc | 1 - gdbserver/linux-low.cc | 9 -------- gdbserver/linux-low.h | 5 ----- gdbserver/linux-m32r-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-ppc-low.cc | 12 ++++++----- gdbserver/linux-s390-low.cc | 11 +++++----- gdbserver/linux-sh-low.cc | 1 - gdbserver/linux-tic6x-low.cc | 1 - gdbserver/linux-tile-low.cc | 1 - gdbserver/linux-x86-low.cc | 9 ++++---- gdbserver/linux-xtensa-low.cc | 1 - 16 files changed, 63 insertions(+), 42 deletions(-) diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index e42b3d84390..a7635e06b1e 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,42 @@ +2020-04-02 Tankut Baris Aktemur + + Remote the 'supports_tracepoints' linux target op and let the + concrete linux target define it by overriding the op declared in + process_stratum_target. + + * linux-low.h (struct linux_target_ops): Remove the op. + (class linux_process_target) : Remove. + * linux-low.cc (linux_process_target::supports_tracepoints): Remove. + * linux-x86-low.cc (class x86_target) : + Declare. + (x86_supports_tracepoints): Turn into... + (x86_target::supports_tracepoints): ...this. + (the_low_target): Remove the op field. + * linux-aarch64-low.cc (class aarch64_target) + : Declare. + (aarch64_supports_tracepoints): Turn into... + (aarch64_target::supports_tracepoints): ...this. + (the_low_target): Remove the op field. + * linux-ppc-low.cc (class ppc_target) : + Declare. + (ppc_supports_tracepoints): Turn into... + (ppc_target::supports_tracepoints): ...this. + (the_low_target): Remove the op field. + * linux-s390-low.cc (class s390_target) : + Declare. + (s390_supports_tracepoints): Turn into... + (s390_target::supports_tracepoints): ...this. + (the_low_target): Remove the op field. + * linux-arm-low.cc (the_low_target): Remove the op field. + * linux-bfin-low.cc (the_low_target): Ditto. + * linux-crisv32-low.cc (the_low_target): Ditto. + * linux-m32r-low.cc (the_low_target): Ditto. + * linux-m68k-low.cc (the_low_target): Ditto. + * linux-sh-low.cc (the_low_target): Ditto. + * linux-tic6x-low.cc (the_low_target): Ditto. + * linux-tile-low.cc (the_low_target): Ditto. + * linux-xtensa-low.cc (the_low_target): Ditto. + 2020-04-02 Tankut Baris Aktemur Remove the 'process_qsupported' linux target op and let a concrete diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 56bf027b888..cbca3d6a9ad 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -65,6 +65,8 @@ public: bool supports_z_point_type (char z_type) override; + bool supports_tracepoints () override; + protected: void low_arch_setup () override; @@ -715,13 +717,13 @@ aarch64_target::get_regs_info () return ®s_info_aarch64; } -/* Implementation of linux_target_ops method "supports_tracepoints". */ +/* Implementation of target ops method "supports_tracepoints". */ -static int -aarch64_supports_tracepoints (void) +bool +aarch64_target::supports_tracepoints () { if (current_thread == NULL) - return 1; + return true; else { /* We don't support tracepoints on aarch32 now. */ @@ -3147,7 +3149,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - aarch64_supports_tracepoints, aarch64_get_thread_area, aarch64_install_fast_tracepoint_jump_pad, aarch64_emit_ops, diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index 9e74b03df07..383f217277a 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -1117,7 +1117,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index aa8a16e1d16..06fcf76bf50 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -171,7 +171,6 @@ bfin_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index f0851cabedd..ab711c41690 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -468,7 +468,6 @@ crisv32_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index e94118bd800..2b522348201 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6441,15 +6441,6 @@ linux_process_target::get_ipa_tdesc_idx () return (*the_low_target.get_ipa_tdesc_idx) (); } -bool -linux_process_target::supports_tracepoints () -{ - if (*the_low_target.supports_tracepoints == NULL) - return false; - - return (*the_low_target.supports_tracepoints) (); -} - CORE_ADDR linux_process_target::read_pc (regcache *regcache) { diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index bc45e3fbcb5..223b19ddafd 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -131,9 +131,6 @@ struct lwp_info; struct linux_target_ops { - /* Returns true if the low target supports tracepoints. */ - int (*supports_tracepoints) (void); - /* Fill ADDRP with the thread area address of LWPID. Returns 0 on success, -1 on failure. */ int (*get_thread_area) (int lwpid, CORE_ADDR *addrp); @@ -296,8 +293,6 @@ public: unsigned char *myaddr, unsigned int len) override; #endif - bool supports_tracepoints () override; - CORE_ADDR read_pc (regcache *regcache) override; void write_pc (regcache *regcache, CORE_ADDR pc) override; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index 3ba2b0ea5ee..601522bc611 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -161,7 +161,6 @@ m32r_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index 4f9b68b8eef..6e16764d394 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void) } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 0c3d5eb9897..063707c5c7c 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -62,6 +62,9 @@ public: void low_supply_ptrace_register (regcache *regcache, int regno, const char *buf) override; + + bool supports_tracepoints () override; + protected: void low_arch_setup () override; @@ -1024,12 +1027,12 @@ ppc_target::low_arch_setup () } } -/* Implementation of linux_target_ops method "supports_tracepoints". */ +/* Implementation of target ops method "supports_tracepoints". */ -static int -ppc_supports_tracepoints (void) +bool +ppc_target::supports_tracepoints () { - return 1; + return true; } /* Get the thread area address. This is used to recognize which @@ -3428,7 +3431,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - ppc_supports_tracepoints, ppc_get_thread_area, ppc_install_fast_tracepoint_jump_pad, ppc_emit_ops, diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index d3be399315c..22305fe9ce9 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -63,6 +63,8 @@ public: bool supports_z_point_type (char z_type) override; + bool supports_tracepoints () override; + void low_collect_ptrace_register (regcache *regcache, int regno, char *buf) override; @@ -770,12 +772,12 @@ s390_target::get_regs_info () return &myregs_info; } -/* The "supports_tracepoints" linux_target_ops method. */ +/* The "supports_tracepoints" target ops method. */ -static int -s390_supports_tracepoints (void) +bool +s390_target::supports_tracepoints () { - return 1; + return true; } /* Implementation of linux_target_ops method "get_thread_area". */ @@ -2845,7 +2847,6 @@ s390_emit_ops (void) } struct linux_target_ops the_low_target = { - s390_supports_tracepoints, s390_get_thread_area, s390_install_fast_tracepoint_jump_pad, s390_emit_ops, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index ac6b1d7b1c1..4fead793f97 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -192,7 +192,6 @@ sh_target::low_arch_setup () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index bf7099bf7fc..e385edd4324 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -423,7 +423,6 @@ tic6x_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 355657bf95e..ad2e716e434 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index bf5245e5b2d..b7bbc81cbee 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -108,6 +108,8 @@ public: void process_qsupported (char **features, int count) override; + bool supports_tracepoints () override; + protected: void low_arch_setup () override; @@ -1109,10 +1111,10 @@ x86_get_syscall_trapinfo (struct regcache *regcache, int *sysno) collect_register_by_name (regcache, "orig_eax", sysno); } -static int -x86_supports_tracepoints (void) +bool +x86_target::supports_tracepoints () { - return 1; + return true; } static void @@ -2967,7 +2969,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_supports_tracepoints, x86_get_thread_area, x86_install_fast_tracepoint_jump_pad, x86_emit_ops, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index b6d0889e998..5a009df551d 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -329,7 +329,6 @@ xtensa_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ NULL, /* emit_ops */ -- 2.30.2