public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver/linux-low: turn 'emit_ops' into a method
@ 2020-04-02 13:19 Tankut Baris Aktemur
  0 siblings, 0 replies; only message in thread
From: Tankut Baris Aktemur @ 2020-04-02 13:19 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ab64c99982e1e26439dc66b2ea04aa0d4b0458c9

commit ab64c99982e1e26439dc66b2ea04aa0d4b0458c9
Author: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Date:   Thu Apr 2 15:11:30 2020 +0200

    gdbserver/linux-low: turn 'emit_ops' into a method
    
    gdbserver/ChangeLog:
    2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
    
            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) <emit_ops>: Remove.
            * linux-low.cc (linux_process_target::emit_ops): Remove.
            * linux-x86-low.cc (class x86_target) <emit_ops>: 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) <emit_ops>: 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) <emit_ops>: 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) <emit_ops>: 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.

Diff:
---
 gdbserver/ChangeLog            | 35 +++++++++++++++++++++++++++++++++++
 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 -
 16 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index a7689caeea3..203b53453cf 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,38 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+	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) <emit_ops>: Remove.
+	* linux-low.cc (linux_process_target::emit_ops): Remove.
+	* linux-x86-low.cc (class x86_target) <emit_ops>: 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) <emit_ops>: 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) <emit_ops>: 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) <emit_ops>: 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.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
 	Remove the 'install_fast_tracepoint_jump_pad' and
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 37fe93c8959..c9893c80fcd 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-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;
@@ -3091,10 +3093,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;
 }
@@ -3163,7 +3165,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 942f2630236..a235f4e1c55 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, /* 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 4eaa19ebf3d..b20edf7adc4 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, /* 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 25816cc3812..ca56cabecd3 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, /* emit_ops */
   NULL, /* supports_range_stepping */
   cris_supports_hardware_single_step,
 };
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index f93d495daab..71cc140d69d 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 7c0e358b5b4..6db56d0e106 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);
 
@@ -284,8 +280,6 @@ public:
 
   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 8ce65dac849..82dde9938bd 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, /* 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 017b26bca81..0b30291d3fb 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, /* 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 09a9be306f0..58f6629917c 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -77,6 +77,8 @@ public:
 
   int get_min_fast_tracepoint_insn_len () override;
 
+  struct emit_ops *emit_ops () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -3379,10 +3381,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);
@@ -3452,7 +3454,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 2b093b898bd..5ea4830dd16 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -83,6 +83,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;
@@ -2845,10 +2847,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);
@@ -2861,7 +2863,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 847f686380c..6f270ed989e 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, /* 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 220681e9cec..6a0be06da5e 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, /* 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 7a840c4dbd6..b18134d6d8a 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, /* 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 de992fc062e..8e35ab172bf 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -122,6 +122,8 @@ public:
 
   int get_min_fast_tracepoint_insn_len () override;
 
+  struct emit_ops *emit_ops () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -2934,8 +2936,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 ())
@@ -2990,7 +2992,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 94501216e0c..774ad0a2ccb 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, /* emit_ops */
   NULL, /* supports_range_stepping */
   xtensa_supports_hardware_single_step,
 };


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-02 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 13:19 [binutils-gdb] gdbserver/linux-low: turn 'emit_ops' into a method Tankut Baris Aktemur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).