From patchwork Fri Mar 6 21:31:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tankut Baris Aktemur X-Patchwork-Id: 38503 Received: (qmail 53580 invoked by alias); 6 Mar 2020 21:32:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 52644 invoked by uid 89); 6 Mar 2020 21:32:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 21:32:24 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 13:32:23 -0800 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 06 Mar 2020 13:32:22 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 026LWLHZ022509; Fri, 6 Mar 2020 21:32:21 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 026LWL7W020530; Fri, 6 Mar 2020 22:32:21 +0100 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 026LWL7F020526; Fri, 6 Mar 2020 22:32:21 +0100 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 27/31] gdbserver/linux-low: turn 'supports_range_stepping' into a method Date: Fri, 6 Mar 2020 22:31:35 +0100 Message-Id: <126c5b8412390dbf5f5349b5a887b6b138b9f691.1583529167.git.tankut.baris.aktemur@intel.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes gdbserver/ChangeLog: 2020-03-06 Tankut Baris Aktemur Turn the 'supports_range_stepping' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Declare. * linux-low.cc (linux_process_target::low_supports_range_stepping): Define. (linux_process_target::supports_range_stepping): Update the call site. * linux-x86-low.cc (class x86_target) : Declare. (x86_supports_range_stepping): Turn into... (x86_target::low_supports_range_stepping): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_supports_range_stepping): Turn into... (aarch64_target::low_supports_range_stepping): ...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-ppc-low.cc (the_low_target): Ditto. * linux-s390-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/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 | 10 +++++++--- gdbserver/linux-low.h | 6 +++--- gdbserver/linux-m32r-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-ppc-low.cc | 1 - gdbserver/linux-s390-low.cc | 1 - 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 - 15 files changed, 21 insertions(+), 26 deletions(-) diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index d971cdc2f05..b88415fe16c 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -124,6 +124,8 @@ protected: void low_prepare_to_resume (lwp_info *lwp) override; int low_get_thread_area (int lwpid, CORE_ADDR *addrp) override; + + bool low_supports_range_stepping () override; }; /* The singleton target ops object. */ @@ -3111,12 +3113,12 @@ aarch64_target::get_min_fast_tracepoint_insn_len () return 4; } -/* Implementation of linux_target_ops method "supports_range_stepping". */ +/* Implementation of linux target ops method "low_supports_range_stepping". */ -static int -aarch64_supports_range_stepping (void) +bool +aarch64_target::low_supports_range_stepping () { - return 1; + return true; } /* Implementation of target ops method "sw_breakpoint_from_kind". */ @@ -3166,7 +3168,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - aarch64_supports_range_stepping, aarch64_supports_hardware_single_step, aarch64_get_syscall_trapinfo, }; diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index 15a6350464c..d80b0f30178 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -1119,7 +1119,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ arm_supports_hardware_single_step, arm_get_syscall_trapinfo, }; diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index 4ee7933256c..eb8ef2d4024 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -165,7 +165,6 @@ bfin_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ bfin_supports_hardware_single_step, }; diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index 04301eee94d..05a435d69f9 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -470,7 +470,6 @@ crisv32_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ cris_supports_hardware_single_step, }; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 499beab9740..a68eba11a37 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6289,10 +6289,14 @@ linux_process_target::supports_range_stepping () { if (supports_software_single_step ()) return true; - if (*the_low_target.supports_range_stepping == NULL) - return false; - return (*the_low_target.supports_range_stepping) (); + return low_supports_range_stepping (); +} + +bool +linux_process_target::low_supports_range_stepping () +{ + return false; } bool diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 104355f9594..02955d7b9b6 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 range stepping. */ - int (*supports_range_stepping) (void); - /* See target.h. */ int (*supports_hardware_single_step) (void); @@ -680,6 +677,9 @@ class linux_process_target : public process_stratum_target success, -1 on failure. */ virtual int low_get_thread_area (int lwpid, CORE_ADDR *addrp); + /* Returns true if the low target supports range stepping. */ + virtual bool low_supports_range_stepping (); + /* How many bytes the PC should be decremented after a break. */ int m_decr_pc_after_break; }; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index e45df01240d..330ea693dae 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -163,7 +163,6 @@ m32r_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ m32r_supports_hardware_single_step, }; diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index be7c7141c10..a66e138614a 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -259,7 +259,6 @@ m68k_supports_hardware_single_step (void) } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ m68k_supports_hardware_single_step, }; diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 83e8a536ac9..af2610a173c 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -3456,7 +3456,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ ppc_supports_hardware_single_step, NULL, /* get_syscall_trapinfo */ ppc_get_ipa_tdesc_idx, diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index b23cbf422e4..2f6217817f5 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -2857,7 +2857,6 @@ s390_target::emit_ops () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ s390_supports_hardware_single_step, NULL, /* get_syscall_trapinfo */ s390_get_ipa_tdesc_idx, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index 9fa76e92bc4..8777c3df27f 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -194,7 +194,6 @@ sh_target::low_arch_setup () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ sh_supports_hardware_single_step, }; diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index 095ed99bc2e..bc17f3416c6 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -425,7 +425,6 @@ tic6x_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ tic6x_supports_hardware_single_step, }; diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 7250f6c3476..a4874053436 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -226,7 +226,6 @@ tile_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ tile_supports_hardware_single_step, }; diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index bf26742b66e..6aae77a032c 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -174,6 +174,8 @@ protected: int low_get_thread_area (int lwpid, CORE_ADDR *addrp) override; + bool low_supports_range_stepping () override; + private: /* Update all the target description of all processes; a new GDB @@ -2949,10 +2951,10 @@ x86_target::sw_breakpoint_from_kind (int kind, int *size) return x86_breakpoint; } -static int -x86_supports_range_stepping (void) +bool +x86_target::low_supports_range_stepping () { - return 1; + return true; } /* Implementation of linux_target_ops method "supports_hardware_single_step". @@ -2985,7 +2987,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_supports_range_stepping, x86_supports_hardware_single_step, x86_get_syscall_trapinfo, x86_get_ipa_tdesc_idx, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index 4eb2b4b8524..a0482525ac4 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -331,7 +331,6 @@ xtensa_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_range_stepping */ xtensa_supports_hardware_single_step, };