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

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

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_prepare_to_resume>: Declare.
* linux-low.cc (linux_process_target::low_prepare_to_resume):
Define.

Update the callers below:

(linux_process_target::resume_one_lwp_throw)
(linux_process_target::low_prepare_to_resume)

* linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
Declare.
(x86_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_prepare_to_resume>: Declare.
(aarch64_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
Declare.
(arm_prepare_to_resume): Turn into...
(arm_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
Declare.
(mips_linux_prepare_to_resume): Turn into...
(mips_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* 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.

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 bb17a062c7bfef2f2b0585746c05def7beec2be7..8c5ca79f1551da7399e50b1a8f44efa9bab4a9a2 100644 (file)
@@ -1,3 +1,47 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn the 'prepare_to_resume' linux target op into a method of
+       linux_process_target.
+
+       * linux-low.h (struct linux_target_ops): Remove the op.
+       (class linux_process_target) <low_prepare_to_resume>: Declare.
+       * linux-low.cc (linux_process_target::low_prepare_to_resume):
+       Define.
+
+       Update the callers below:
+
+       (linux_process_target::resume_one_lwp_throw)
+       (linux_process_target::low_prepare_to_resume)
+
+       * linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
+       Declare.
+       (x86_target::low_prepare_to_resume): Define.
+       (the_low_target): Remove the op field.
+       * linux-aarch64-low.cc (class aarch64_target)
+       <low_prepare_to_resume>: Declare.
+       (aarch64_target::low_prepare_to_resume): Define.
+       (the_low_target): Remove the op field.
+       * linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
+       Declare.
+       (arm_prepare_to_resume): Turn into...
+       (arm_target::low_prepare_to_resume): ...this.
+       (the_low_target): Remove the op field.
+       * linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
+       Declare.
+       (mips_linux_prepare_to_resume): Turn into...
+       (mips_target::low_prepare_to_resume): ...this.
+       (the_low_target): Remove the op field.
+       * linux-bfin-low.cc (the_low_target): Remove the op field.
+       * 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.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn the 'new_process', 'delete_process', 'new_thread',
index 3769e815216708d401827d687ce2772c03548dcb..a99b97929cf7d1f9d02f79791f2b0a3fa6cf0bf4 100644 (file)
@@ -103,6 +103,8 @@ protected:
   void low_delete_thread (arch_lwp_info *) override;
 
   void low_new_fork (process_info *parent, process_info *child) override;
+
+  void low_prepare_to_resume (lwp_info *lwp) override;
 };
 
 /* The singleton target ops object.  */
@@ -123,6 +125,12 @@ aarch64_target::low_cannot_store_register (int regno)
                          "is not implemented by the target");
 }
 
+void
+aarch64_target::low_prepare_to_resume (lwp_info *lwp)
+{
+  aarch64_linux_prepare_to_resume (lwp);
+}
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -3139,7 +3147,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_linux_prepare_to_resume,
   NULL, /* process_qsupported */
   aarch64_supports_tracepoints,
   aarch64_get_thread_area,
index 8ec5bc156f71b32e42150715bb59fe3114b2be0d..f6429f0475c420dde8a166efd1cf906cde58f711 100644 (file)
@@ -109,6 +109,8 @@ protected:
   void low_delete_thread (arch_lwp_info *) override;
 
   void low_new_fork (process_info *parent, process_info *child) override;
+
+  void low_prepare_to_resume (lwp_info *lwp) override;
 };
 
 /* The singleton target ops object.  */
@@ -813,8 +815,8 @@ arm_target::low_new_fork (process_info *parent, process_info *child)
 
 /* Called when resuming a thread.
    If the debug regs have changed, update the thread's copies.  */
-static void
-arm_prepare_to_resume (struct lwp_info *lwp)
+void
+arm_target::low_prepare_to_resume (lwp_info *lwp)
 {
   struct thread_info *thread = get_lwp_thread (lwp);
   int pid = lwpid_of (thread);
@@ -1115,7 +1117,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  arm_prepare_to_resume,
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index c8e9d33f176e1f5e9ac0a0c31f615828512c7ef6..3e3f39a1ba5822fec8b26cec15615d57bde7e436 100644 (file)
@@ -171,7 +171,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index e87873e8b2ab0ccdf15574011bb2664550def9f0..d262fae9a950fb73fd9d94ee6223937eaa7cad82 100644 (file)
@@ -468,7 +468,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index 019b1231034253a585f09a72e02b2025f734f0e8..3105db6d01225063543b3e9985da1b37f5b9ca5d 100644 (file)
@@ -1530,8 +1530,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
       regcache_invalidate_thread (thread);
 
       /* Finally, let it resume.  */
-      if (the_low_target.prepare_to_resume != NULL)
-       the_low_target.prepare_to_resume (lwp);
+      low_prepare_to_resume (lwp);
     }
   catch (const gdb_exception_error &ex)
     {
@@ -4322,8 +4321,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
                  lwpid_of (thread), step ? "step" : "continue", signal,
                  lwp->stop_expected ? "expected" : "not expected");
 
-  if (the_low_target.prepare_to_resume != NULL)
-    the_low_target.prepare_to_resume (lwp);
+  low_prepare_to_resume (lwp);
 
   regcache_invalidate_thread (thread);
   errno = 0;
@@ -4355,6 +4353,12 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
   lwp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
 }
 
+void
+linux_process_target::low_prepare_to_resume (lwp_info *lwp)
+{
+  /* Nop.  */
+}
+
 /* Called when we try to resume a stopped LWP and that errors out.  If
    the LWP is no longer in ptrace-stopped state (meaning it's zombie,
    or about to become), discard the error, clear any pending status
index f111945cf93a8c7e8f1009611bf66a781809c25d..49fbc5edcec85c34a2f505fcba2c559131a7b61d 100644 (file)
@@ -131,9 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  /* Hook to call prior to resuming a thread.  */
-  void (*prepare_to_resume) (struct lwp_info *);
-
   /* Hook to support target specific qSupported.  */
   void (*process_qsupported) (char **, int count);
 
@@ -720,6 +717,9 @@ protected:
   /* Hook to call, if any, when a new fork is attached.  */
   virtual void low_new_fork (process_info *parent, process_info *child);
 
+  /* Hook to call prior to resuming a thread.  */
+  virtual void low_prepare_to_resume (lwp_info *lwp);
+
   /* How many bytes the PC should be decremented after a break.  */
   virtual int low_decr_pc_after_break ();
 };
index 4d335c70eda9d6452c6d898d34b236ced0e4a88b..bae0f25e1830872d4f53584d9984a80548495e3f 100644 (file)
@@ -161,7 +161,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index 2076f0dc8b443949305f91a4e17d83e70012fdfa..cfb0a0ac2bfffa077deda660d6634d6669135f93 100644 (file)
@@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index c77834ebc90aba0b3e2db904d9777903b3045614..6c3bc1cc5fb997a23ad6f37b0ceaa4d121a834b5 100644 (file)
@@ -80,6 +80,8 @@ protected:
   void low_delete_thread (arch_lwp_info *) override;
 
   void low_new_fork (process_info *parent, process_info *child) override;
+
+  void low_prepare_to_resume (lwp_info *lwp) override;
 };
 
 /* The singleton target ops object.  */
@@ -491,12 +493,12 @@ mips_target::low_new_fork (process_info *parent,
 
   child_private->watch_mirror = parent_private->watch_mirror;
 }
-/* This is the implementation of linux_target_ops method
-   prepare_to_resume.  If the watch regs have changed, update the
+/* This is the implementation of linux target ops method
+   low_prepare_to_resume.  If the watch regs have changed, update the
    thread's copies.  */
 
-static void
-mips_linux_prepare_to_resume (struct lwp_info *lwp)
+void
+mips_target::low_prepare_to_resume (lwp_info *lwp)
 {
   ptid_t ptid = ptid_of (get_lwp_thread (lwp));
   struct process_info *proc = find_process_pid (ptid.pid ());
@@ -996,7 +998,6 @@ mips_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  mips_linux_prepare_to_resume
 };
 
 /* The linux target ops object.  */
index 4f3a643f18f3e69b8cdeee4324c26a1462dff66f..22fda3306f29e755ab1b64a43b17d0b592f069fc 100644 (file)
@@ -3428,7 +3428,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   ppc_supports_tracepoints,
   ppc_get_thread_area,
index be99c26c58d5ab261e53ac6b3ae1dbfdd53caf3c..e46375f59c4f7d408f132d187f5b6e4fce339a28 100644 (file)
@@ -2845,7 +2845,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   s390_supports_tracepoints,
   s390_get_thread_area,
index 8b69521f100b023d74e29f14cd0cf4de63867572..d2d0f0b0958a634c9246852702c3fa2e0584b4e0 100644 (file)
@@ -192,7 +192,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index 9f62899eaf9c556e2528c90cd4fe909ce823ac4c..ddb84e7517ed708dae724b34a5b8824ee15a3407 100644 (file)
@@ -423,7 +423,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index 21650c846a186dff3b5f52faec7c6f966df93fe9..5268f40ccf13d64a2bc3e61f4914a7abddf50393 100644 (file)
@@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */
index be68e005f00f368811751b11272fbe40d5f4f982..f9459dc18cb31e19b6de581d22fe74a7cfbb032f 100644 (file)
@@ -155,6 +155,8 @@ protected:
   void low_delete_thread (arch_lwp_info *) override;
 
   void low_new_fork (process_info *parent, process_info *child) override;
+
+  void low_prepare_to_resume (lwp_info *lwp) override;
 };
 
 /* The singleton target ops object.  */
@@ -763,6 +765,13 @@ x86_target::low_new_fork (process_info *parent, process_info *child)
   *child->priv->arch_private = *parent->priv->arch_private;
 }
 
+void
+x86_target::low_prepare_to_resume (lwp_info *lwp)
+{
+  /* This comes from nat/.  */
+  x86_linux_prepare_to_resume (lwp);
+}
+
 /* See nat/x86-dregs.h.  */
 
 struct x86_debug_reg_state *
@@ -2954,7 +2963,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_linux_prepare_to_resume,
   x86_linux_process_qsupported,
   x86_supports_tracepoints,
   x86_get_thread_area,
index dbb87a59970d4eef74ada5613acd102582391b26..a58a74b98d5d53907570d5369ea1c31f7a0bfcc5 100644 (file)
@@ -329,7 +329,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
   NULL, /* supports_tracepoints */
   NULL, /* get_thread_area */