gdbserver: turn target op 'detach' into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 20 Feb 2020 16:35:03 +0000 (17:35 +0100)
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn process_stratum_target's detach op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(detach_inferior): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_detach): Turn into ...
(linux_process_target::detach): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_detach): Turn into ...
(lynx_process_target::detach): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_detach): Turn into ...
(nto_process_target::detach): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_detach): Turn into ...
(win32_process_target::detach): ... this.
* win32-low.h (class win32_process_target): Update.

gdbserver/ChangeLog
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/lynx-low.cc
gdbserver/lynx-low.h
gdbserver/nto-low.cc
gdbserver/nto-low.h
gdbserver/target.h
gdbserver/win32-low.cc
gdbserver/win32-low.h

index da55b3884e448b4a0f9527220d6b8a8bff7400a6..ac10f27f556dc5756303d3283e2592f75e8b4b4c 100644 (file)
@@ -1,3 +1,31 @@
+2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn process_stratum_target's detach op into a method of
+       process_target.
+
+       * target.h (struct process_stratum_target): Remove the target op.
+       (class process_target): Add the target op.
+       (detach_inferior): Update the macro.
+
+       Update the derived classes and callers below.
+
+       * linux-low.cc (linux_target_ops): Update.
+       (linux_detach): Turn into ...
+       (linux_process_target::detach): ... this.
+       * linux-low.h (class linux_process_target): Update.
+       * lynx-low.cc (lynx_target_ops): Update.
+       (lynx_detach): Turn into ...
+       (lynx_process_target::detach): ... this.
+       * lynx-low.h (class lynx_process_target): Update.
+       * nto-low.cc (nto_target_ops): Update.
+       (nto_detach): Turn into ...
+       (nto_process_target::detach): ... this.
+       * nto-low.h (class nto_process_target): Update.
+       * win32-low.cc (win32_target_ops): Update.
+       (win32_detach): Turn into ...
+       (win32_process_target::detach): ... this.
+       * win32-low.h (class win32_process_target): Update.
+
 2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn process_stratum_target's kill op into a method of
index 4510e3a1c5f7ba60d1dcd2c0fa48450b5ab09558..1feb7d971cd67f5be4ab569759b65aaf913595bc 100644 (file)
@@ -1603,8 +1603,8 @@ linux_detach_lwp_callback (thread_info *thread)
   linux_detach_one_lwp (lwp);
 }
 
-static int
-linux_detach (process_info *process)
+int
+linux_process_target::detach (process_info *process)
 {
   struct lwp_info *main_lwp;
 
@@ -7359,7 +7359,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-  linux_detach,
   linux_mourn,
   linux_join,
   linux_thread_alive,
index 4f8801150d5908d83c568933360ffbb94e55648e..e8789e9c8a9cf7e464b7639222d739d875fd58a1 100644 (file)
@@ -278,6 +278,8 @@ public:
   int attach (unsigned long pid) override;
 
   int kill (process_info *proc) override;
+
+  int detach (process_info *proc) override;
 };
 
 #define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
index f6359e8157518af02a79bdb3303d7e5f9ff45340..a6eceaf25b1b8efe8787964f508311e68829249f 100644 (file)
@@ -535,8 +535,8 @@ lynx_process_target::kill (process_info *process)
 
 /* Implement the detach target_ops method.  */
 
-static int
-lynx_detach (process_info *process)
+int
+lynx_process_target::detach (process_info *process)
 {
   ptid_t ptid = lynx_ptid_t (process->pid, 0);
 
@@ -726,7 +726,6 @@ static lynx_process_target the_lynx_target;
 /* The LynxOS target_ops vector.  */
 
 static process_stratum_target lynx_target_ops = {
-  lynx_detach,
   lynx_mourn,
   lynx_join,
   lynx_thread_alive,
index cf357ff9a1f22f0fa6ada7c348fbc496088fc1bc..9b8065e3f374f96b223bf9b9badb97eed2936840 100644 (file)
@@ -64,6 +64,8 @@ public:
   int attach (unsigned long pid) override;
 
   int kill (process_info *proc) override;
+
+  int detach (process_info *proc) override;
 };
 
 /* The inferior's target description.  This is a global because the
index 15b3dc37f01eafe6f5367e26088c42e749362093..ceff0d432e5f916330321b1674f97162c6e8fcc9 100644 (file)
@@ -409,8 +409,8 @@ nto_process_target::kill (process_info *proc)
 
 /* Detach from process PID.  */
 
-static int
-nto_detach (process_info *proc)
+int
+nto_process_target::detach (process_info *proc)
 {
   TRACE ("%s %d\n", __func__, proc->pid);
   do_detach ();
@@ -935,7 +935,6 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
 static nto_process_target the_nto_target;
 
 static process_stratum_target nto_target_ops = {
-  nto_detach,
   nto_mourn,
   NULL, /* nto_join */
   nto_thread_alive,
index 5564dda3bb258d1355fcf397e18f4e726ea19a3c..e7e10fcb842008917b2293b856551b51f0526f09 100644 (file)
@@ -54,6 +54,8 @@ public:
   int attach (unsigned long pid) override;
 
   int kill (process_info *proc) override;
+
+  int detach (process_info *proc) override;
 };
 
 /* The inferior's target description.  This is a global because the
index 0f3cb35f453766fa0889d59349a0dfdab645ff2d..6c7c286993875fb51ac04808aaaca80f779bfdde 100644 (file)
@@ -70,11 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Detach from process PROC.  Return -1 on failure, and 0 on
-     success.  */
-
-  int (*detach) (process_info *proc);
-
   /* The inferior process has died.  Do what is right.  */
 
   void (*mourn) (struct process_info *proc);
@@ -487,6 +482,10 @@ public:
 
   /* Kill process PROC.  Return -1 on failure, and 0 on success.  */
   virtual int kill (process_info *proc) = 0;
+
+  /* Detach from process PROC.  Return -1 on failure, and 0 on
+     success.  */
+  virtual int detach (process_info *proc) = 0;
 };
 
 extern process_stratum_target *the_target;
@@ -524,7 +523,7 @@ int kill_inferior (process_info *proc);
     } while (0)
 
 #define detach_inferior(proc) \
-  (*the_target->detach) (proc)
+  the_target->pt->detach (proc)
 
 #define mythread_alive(pid) \
   (*the_target->thread_alive) (pid)
index a7fb1244e342251fb21813f0897642743ad99c89..9cefb29b0464f79c1006aa7b26bd648b9be56d71 100644 (file)
@@ -843,8 +843,8 @@ win32_process_target::kill (process_info *process)
 
 /* Implementation of target_ops::detach.  */
 
-static int
-win32_detach (process_info *process)
+int
+win32_process_target::detach (process_info *process)
 {
   winapi_DebugActiveProcessStop DebugActiveProcessStop = NULL;
   winapi_DebugSetProcessKillOnExit DebugSetProcessKillOnExit = NULL;
@@ -1839,7 +1839,6 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
 static win32_process_target the_win32_target;
 
 static process_stratum_target win32_target_ops = {
-  win32_detach,
   win32_mourn,
   win32_join,
   win32_thread_alive,
index 45a6262e38e41ff200858fdb436c794dbf543aa8..10096b8768293996f4dc9871b746039aee92f969 100644 (file)
@@ -113,6 +113,8 @@ public:
   int attach (unsigned long pid) override;
 
   int kill (process_info *proc) override;
+
+  int detach (process_info *proc) override;
 };
 
 /* Retrieve the context for this thread, if not already retrieved.  */
This page took 0.051585 seconds and 4 git commands to generate.