gdbserver/linux-low: turn 'siginfo_fixup' into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)
gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'siginfo_fixup' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <siginfo_fixup>
<low_siginfo_fixup>: Declare.
* linux-low.cc (siginfo_fixup): Turn into...
(linux_process_target::siginfo_fixup): ...this.
(linux_process_target::low_siginfo_fixup): Define.
* linux-x86-low.cc (class x86_target) <low_siginfo_fixup>: Declare.
(x86_siginfo_fixup): Turn into...
(x86_target::low_siginfo_fixup): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target):
<low_siginfo_fixup>: Declare.
(aarch64_linux_siginfo_fixup): Turn into...
(aarch64_target::low_siginfo_fixup): ...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-mips-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.

17 files changed:
gdbserver/ChangeLog
gdbserver/linux-aarch64-low.cc
gdbserver/linux-arm-low.cc
gdbserver/linux-bfin-low.cc
gdbserver/linux-crisv32-low.cc
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/linux-m32r-low.cc
gdbserver/linux-m68k-low.cc
gdbserver/linux-mips-low.cc
gdbserver/linux-ppc-low.cc
gdbserver/linux-s390-low.cc
gdbserver/linux-sh-low.cc
gdbserver/linux-tic6x-low.cc
gdbserver/linux-tile-low.cc
gdbserver/linux-x86-low.cc
gdbserver/linux-xtensa-low.cc

index f8a2bd802b3b0736b2dcaaf010fce1eaa0abeb1c..6ca38f07e52e087e0b9674c69f657026f21083cd 100644 (file)
@@ -1,3 +1,36 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn the 'siginfo_fixup' linux target op into a method of
+       linux_process_target.
+
+       * linux-low.h (struct linux_target_ops): Remove the op.
+       (class linux_process_target) <siginfo_fixup>
+       <low_siginfo_fixup>: Declare.
+       * linux-low.cc (siginfo_fixup): Turn into...
+       (linux_process_target::siginfo_fixup): ...this.
+       (linux_process_target::low_siginfo_fixup): Define.
+       * linux-x86-low.cc (class x86_target) <low_siginfo_fixup>: Declare.
+       (x86_siginfo_fixup): Turn into...
+       (x86_target::low_siginfo_fixup): ...this.
+       (the_low_target): Remove the op field.
+       * linux-aarch64-low.cc (class aarch64_target):
+       <low_siginfo_fixup>: Declare.
+       (aarch64_linux_siginfo_fixup): Turn into...
+       (aarch64_target::low_siginfo_fixup): ...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-mips-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.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn the 'collect_ptrace_register' and 'supply_ptrace_register'
index dfbfa59cba1a6c9a9a2d5ba888dfc68d3fcc2ce5..79c7db92e76260d638181b4b0252d97d1bdfca1b 100644 (file)
@@ -90,6 +90,9 @@ protected:
   bool low_stopped_by_watchpoint () override;
 
   CORE_ADDR low_stopped_data_address () override;
+
+  bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                         int direction) override;
 };
 
 /* The singleton target ops object.  */
@@ -493,10 +496,11 @@ ps_get_thread_area (struct ps_prochandle *ph,
                                     is_64bit_tdesc ());
 }
 
-/* Implementation of linux_target_ops method "siginfo_fixup".  */
+/* Implementation of linux target ops method "low_siginfo_fixup".  */
 
-static int
-aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
+bool
+aarch64_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                                  int direction)
 {
   /* Is the inferior 32-bit?  If so, then fixup the siginfo object.  */
   if (!is_64bit_tdesc ())
@@ -508,10 +512,10 @@ aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
        aarch64_siginfo_from_compat_siginfo (native,
                                             (struct compat_siginfo *) inf);
 
-      return 1;
+      return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Implementation of linux_target_ops method "new_process".  */
@@ -3113,7 +3117,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_linux_siginfo_fixup,
   aarch64_linux_new_process,
   aarch64_linux_delete_process,
   aarch64_linux_new_thread,
index 78e93d304f505ac77aafd379903fcd5b7690883d..267899f99ef786fa7b52d922e5b8a170d4c26052 100644 (file)
@@ -1105,7 +1105,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   arm_new_process,
   arm_delete_process,
   arm_new_thread,
index 5f0d72fed74383f753314a7fb0064c1fe260e029..6beb61ff3de6df6fc8f8582830ef34f7eb30f5e9 100644 (file)
@@ -171,7 +171,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index fe4b68ef4d84c6d7c211c3a29fbf1bdfd14ec806..a7f8b480799cf5d77579a836aa09ce45e013aa0f 100644 (file)
@@ -468,7 +468,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 658ea32f1353f9523c653922f15247035fa4b030..755c3e00a9e4aaf056389ce39e0f59de0f5931fc 100644 (file)
@@ -6016,16 +6016,11 @@ linux_process_target::qxfer_osdata (const char *annex,
   return linux_common_xfer_osdata (annex, readbuf, offset, len);
 }
 
-/* Convert a native/host siginfo object, into/from the siginfo in the
-   layout of the inferiors' architecture.  */
-
-static void
-siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
+void
+linux_process_target::siginfo_fixup (siginfo_t *siginfo,
+                                    gdb_byte *inf_siginfo, int direction)
 {
-  int done = 0;
-
-  if (the_low_target.siginfo_fixup != NULL)
-    done = the_low_target.siginfo_fixup (siginfo, inf_siginfo, direction);
+  bool done = low_siginfo_fixup (siginfo, inf_siginfo, direction);
 
   /* If there was no callback, or the callback didn't do anything,
      then just do a straight memcpy.  */
@@ -6038,6 +6033,13 @@ siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
     }
 }
 
+bool
+linux_process_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                                        int direction)
+{
+  return false;
+}
+
 bool
 linux_process_target::supports_qxfer_siginfo ()
 {
index ca6cf3edc1cef5dfa956f600aa011e5195d871c8..599aead0665cea3b910fd483fb8d90dc02800e83 100644 (file)
@@ -131,12 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  /* Hook to convert from target format to ptrace format and back.
-     Returns true if any conversion was done; false otherwise.
-     If DIRECTION is 1, then copy from INF to NATIVE.
-     If DIRECTION is 0, copy from NATIVE to INF.  */
-  int (*siginfo_fixup) (siginfo_t *native, gdb_byte *inf, int direction);
-
   /* Hook to call when a new process is created or attached to.
      If extra per-process architecture-specific data is needed,
      allocate it here.  */
@@ -628,6 +622,11 @@ private:
      registers meanwhile, we have the cached data we can rely on.  */
   bool check_stopped_by_watchpoint (lwp_info *child);
 
+  /* Convert a native/host siginfo object, into/from the siginfo in the
+     layout of the inferiors' architecture.  */
+  void siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo,
+                     int direction);
+
 protected:
   /* The architecture-specific "low" methods are listed below.  */
 
@@ -683,6 +682,13 @@ protected:
   virtual void low_supply_ptrace_register (regcache *regcache, int regno,
                                           const char *buf);
 
+  /* Hook to convert from target format to ptrace format and back.
+     Returns true if any conversion was done; false otherwise.
+     If DIRECTION is 1, then copy from INF to NATIVE.
+     If DIRECTION is 0, copy from NATIVE to INF.  */
+  virtual bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                                 int direction);
+
   /* How many bytes the PC should be decremented after a break.  */
   virtual int low_decr_pc_after_break ();
 };
index 2dc25f7c66835795507502e7d87ba85aab16334c..f42cb2792b0193830ad7a633a4e716e7ea66f0b8 100644 (file)
@@ -161,7 +161,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 84eccbc14ef5e27d2dbb025b0e161adaabcd30a9..bc0f37b52e5edbf69dd70dbdc1cc8d67d51581a1 100644 (file)
@@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 78e243c3d4024370a5280593b5cce9fcbf1a3855..b7098a72c6c5129334a9ff2d40f6d1d73d612928 100644 (file)
@@ -986,7 +986,6 @@ mips_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   mips_linux_new_process,
   mips_linux_delete_process,
   mips_linux_new_thread,
index e0310856c2098903173815fe605adbc987a99863..573a6d60557cb5543749be94ad26bf6aa83c2f46 100644 (file)
@@ -3428,7 +3428,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index f7e439ac612ca26c93c4e42359f21ccfba214cfc..cd4dc8ab31e783f03df7d3438f4b7593dd03f867 100644 (file)
@@ -2845,7 +2845,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 08985338db329ceda3d594bdd655689b8229bda1..070d21fbdd90fb567bceae25bf9f91311a4fcddc 100644 (file)
@@ -192,7 +192,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 8f5eff7fdb55dbe9768770c4f50fa690714ff7b6..573b4581565a0e78e4c2a72ea3e310f9a9541579 100644 (file)
@@ -423,7 +423,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index 72697649fbcd67dbe4dd719970ff934a98dd2c06..ce487967aad9438c57c1c60a94a7092076a327d6 100644 (file)
@@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
index d33833daa6c466d0c291010603a49ecb214b80fe..bf4e6ec2c8ce6d33f70c7913a3e746f651a71456 100644 (file)
@@ -141,6 +141,10 @@ protected:
   /* collect_ptrace_register/supply_ptrace_register are not needed in the
      native i386 case (no registers smaller than an xfer unit), and are not
      used in the biarch case (HAVE_LINUX_USRREGS is not defined).  */
+
+  /* Need to fix up i386 siginfo if host is amd64.  */
+  bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                         int direction) override;
 };
 
 /* The singleton target ops object.  */
@@ -757,8 +761,8 @@ x86_debug_reg_state (pid_t pid)
    from INF to PTRACE.  If DIRECTION is 0, copy from PTRACE to
    INF.  */
 
-static int
-x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
+bool
+x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
 {
 #ifdef __x86_64__
   unsigned int machine;
@@ -775,7 +779,7 @@ x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
                                             FIXUP_X32);
 #endif
 
-  return 0;
+  return false;
 }
 \f
 static int use_xml;
@@ -2926,8 +2930,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  /* need to fix up i386 siginfo if host is amd64 */
-  x86_siginfo_fixup,
   x86_linux_new_process,
   x86_linux_delete_process,
   x86_linux_new_thread,
index 08487145337c130404a03d5b850f228d2e99eefc..b55a6f6674012ddf7a5144f14437508a16303f06 100644 (file)
@@ -329,7 +329,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
   NULL, /* new_thread */
This page took 0.039044 seconds and 4 git commands to generate.