From patchwork Fri Mar 6 21:31:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 38499 Received: (qmail 52806 invoked by alias); 6 Mar 2020 21:32:40 -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 52228 invoked by uid 89); 6 Mar 2020 21:32:35 -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=phdr X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 21:32:23 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 13:32:22 -0800 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2020 13:32:21 -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 026LWL4f022504; 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 026LWLvZ020523; Fri, 6 Mar 2020 22:32:21 +0100 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 026LWK08020519; Fri, 6 Mar 2020 22:32:20 +0100 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 26/31] gdbserver/linux-low: turn 'emit_ops' into a method Date: Fri, 6 Mar 2020 22:31:34 +0100 Message-Id: <3c7f7c10aeb357742f94cdae17c20ba78e0a9d5f.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 Remove the 'emit_ops' linux target ops and let the concrete linux target define the op by overriding the declaration of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Remove. * linux-low.cc (linux_process_target::emit_ops): Remove. * linux-x86-low.cc (class x86_target) : Declare. (x86_emit_ops): Turn into... (x86_target::emit_ops): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_emit_ops): Turn into... (aarch64_target::emit_ops): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) : Declare. (ppc_emit_ops): Turn into... (ppc_target::emit_ops): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) : Declare. (s390_emit_ops): Turn into... (s390_target::emit_ops): ...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/linux-aarch64-low.cc | 9 +++++---- 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 | 6 ------ gdbserver/linux-m32r-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-ppc-low.cc | 9 +++++---- gdbserver/linux-s390-low.cc | 9 +++++---- gdbserver/linux-sh-low.cc | 1 - gdbserver/linux-tic6x-low.cc | 1 - gdbserver/linux-tile-low.cc | 1 - gdbserver/linux-x86-low.cc | 7 ++++--- gdbserver/linux-xtensa-low.cc | 1 - 15 files changed, 19 insertions(+), 39 deletions(-) diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 30d64d8deca..d971cdc2f05 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -80,6 +80,8 @@ public: int get_min_fast_tracepoint_insn_len () override; + struct emit_ops *emit_ops () override; + protected: void low_arch_setup () override; @@ -3092,10 +3094,10 @@ static struct emit_ops aarch64_emit_ops_impl = aarch64_emit_ge_got, }; -/* Implementation of linux_target_ops method "emit_ops". */ +/* Implementation of target ops method "emit_ops". */ -static struct emit_ops * -aarch64_emit_ops (void) +emit_ops * +aarch64_target::emit_ops () { return &aarch64_emit_ops_impl; } @@ -3164,7 +3166,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - aarch64_emit_ops, 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 f4cd374c095..15a6350464c 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, /* emit_ops */ 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 36112be6aa9..4ee7933256c 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, /* emit_ops */ NULL, /* supports_range_stepping */ bfin_supports_hardware_single_step, }; diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index e44a6c25067..04301eee94d 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, /* emit_ops */ NULL, /* supports_range_stepping */ cris_supports_hardware_single_step, }; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index fd820233c5b..499beab9740 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6496,15 +6496,6 @@ linux_process_target::done_accessing_memory () target_unpause_all (true); } -emit_ops * -linux_process_target::emit_ops () -{ - if (the_low_target.emit_ops != NULL) - return (*the_low_target.emit_ops) (); - else - return NULL; -} - /* Extract &phdr and num_phdr in the inferior. Return 0 on success. */ static int diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 7330d9bfb66..104355f9594 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -131,10 +131,6 @@ struct lwp_info; struct linux_target_ops { - /* Return the bytecode operations vector for the current inferior. - Returns NULL if bytecode compilation is not supported. */ - struct emit_ops *(*emit_ops) (void); - /* Returns true if the low target supports range stepping. */ int (*supports_range_stepping) (void); @@ -286,8 +282,6 @@ class linux_process_target : public process_stratum_target void stabilize_threads () override; - struct emit_ops *emit_ops () override; - bool supports_disable_randomization () override; bool supports_qxfer_libraries_svr4 () override; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index 03889b0d990..e45df01240d 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, /* emit_ops */ NULL, /* supports_range_stepping */ m32r_supports_hardware_single_step, }; diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index f2a5718234f..be7c7141c10 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, /* emit_ops */ NULL, /* supports_range_stepping */ m68k_supports_hardware_single_step, }; diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index d75c6ba7d9d..83e8a536ac9 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -79,6 +79,8 @@ public: int get_min_fast_tracepoint_insn_len () override; + struct emit_ops *emit_ops () override; + protected: void low_arch_setup () override; @@ -3381,10 +3383,10 @@ static struct emit_ops ppc64v2_emit_ops_impl = #endif -/* Implementation of linux_target_ops method "emit_ops". */ +/* Implementation of target ops method "emit_ops". */ -static struct emit_ops * -ppc_emit_ops (void) +emit_ops * +ppc_target::emit_ops () { #ifdef __powerpc64__ struct regcache *regcache = get_thread_regcache (current_thread, 0); @@ -3454,7 +3456,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - ppc_emit_ops, NULL, /* supports_range_stepping */ ppc_supports_hardware_single_step, NULL, /* get_syscall_trapinfo */ diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index 9ac84fb20e0..b23cbf422e4 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -88,6 +88,8 @@ public: void low_supply_ptrace_register (regcache *regcache, int regno, const char *buf) override; + struct emit_ops *emit_ops () override; + protected: void low_arch_setup () override; @@ -2839,10 +2841,10 @@ static struct emit_ops s390x_emit_ops = }; #endif -/* The "emit_ops" linux_target_ops method. */ +/* The "emit_ops" target ops method. */ -static struct emit_ops * -s390_emit_ops (void) +emit_ops * +s390_target::emit_ops () { #ifdef __s390x__ struct regcache *regcache = get_thread_regcache (current_thread, 0); @@ -2855,7 +2857,6 @@ s390_emit_ops (void) } struct linux_target_ops the_low_target = { - s390_emit_ops, NULL, /* supports_range_stepping */ s390_supports_hardware_single_step, NULL, /* get_syscall_trapinfo */ diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index 26823237a59..9fa76e92bc4 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, /* emit_ops */ NULL, /* supports_range_stepping */ sh_supports_hardware_single_step, }; diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index cc699e1d2d8..095ed99bc2e 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, /* emit_ops */ NULL, /* supports_range_stepping */ tic6x_supports_hardware_single_step, }; diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 895f2ccd5e7..7250f6c3476 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, /* emit_ops */ NULL, /* supports_range_stepping */ tile_supports_hardware_single_step, }; diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index d4d78286843..bf26742b66e 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -124,6 +124,8 @@ public: int get_min_fast_tracepoint_insn_len () override; + struct emit_ops *emit_ops () override; + protected: void low_arch_setup () override; @@ -2927,8 +2929,8 @@ struct emit_ops i386_emit_ops = }; -static struct emit_ops * -x86_emit_ops (void) +emit_ops * +x86_target::emit_ops () { #ifdef __x86_64__ if (is_64bit_tdesc ()) @@ -2983,7 +2985,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_emit_ops, x86_supports_range_stepping, x86_supports_hardware_single_step, x86_get_syscall_trapinfo, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index 4aab5fec513..4eb2b4b8524 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, /* emit_ops */ NULL, /* supports_range_stepping */ xtensa_supports_hardware_single_step, };