gdbserver: turn target op 'post_create_inferior' 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:02 +0000 (17:35 +0100)
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

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

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_post_create_inferior): Update the macro.
* target.cc (process_target::post_create_inferior): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_post_create_inferior): Turn into ...
(linux_process_target::post_create_inferior): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

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

index 7dd9cf366022e86f2a8c2b79ef21296f49ff01ea..29584074efa031465d2444e5020e4f0ff2c49ddb 100644 (file)
@@ -1,3 +1,23 @@
+2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn process_stratum_target's post_create_inferior op into a method
+       of process_target.
+
+       * target.h (struct process_stratum_target): Remove the target op.
+       (class process_target): Add the target op.
+       (target_post_create_inferior): Update the macro.
+       * target.cc (process_target::post_create_inferior): Define.
+
+       Update the derived classes and callers below.
+
+       * linux-low.cc (linux_target_ops): Update.
+       (linux_post_create_inferior): Turn into ...
+       (linux_process_target::post_create_inferior): ... this.
+       * linux-low.h (class linux_process_target): Update.
+       * lynx-low.cc (lynx_target_ops): Update.
+       * nto-low.cc (nto_target_ops): Update.
+       * win32-low.cc (win32_target_ops): Update.
+
 2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn process_stratum_target's create_inferior op into a method of
index 0521afcfc19576389b66e7f23ba065ba5f61d515..2e3daa2733fc7826defddedf587a3e55b4b109ee 100644 (file)
@@ -1029,8 +1029,8 @@ linux_process_target::create_inferior (const char *program,
 
 /* Implement the post_create_inferior target_ops method.  */
 
-static void
-linux_post_create_inferior (void)
+void
+linux_process_target::post_create_inferior ()
 {
   struct lwp_info *lwp = get_thread_lwp (current_thread);
 
@@ -7359,7 +7359,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-  linux_post_create_inferior,
   linux_attach,
   linux_kill,
   linux_detach,
index f49af7b2be3ca9190a4657d7932043d0d0b5c234..870a0d4d8631970d39c7de775563996a52877340 100644 (file)
@@ -272,6 +272,8 @@ public:
 
   int create_inferior (const char *program,
                       const std::vector<char *> &program_args) override;
+
+  void post_create_inferior () override;
 };
 
 #define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
index 9566e12d2df210b0ab5485efd25384629a5501c8..d9f96de70f6e46635b42f27f53335f64cf1d2b18 100644 (file)
@@ -726,7 +726,6 @@ static lynx_process_target the_lynx_target;
 /* The LynxOS target_ops vector.  */
 
 static process_stratum_target lynx_target_ops = {
-  NULL,  /* post_create_inferior */
   lynx_attach,
   lynx_kill,
   lynx_detach,
index c27126f3126fc31db7745114ef4ec0673deb01ca..c295be732dfbf64ff94b6a7ebe987f83b468aa08 100644 (file)
@@ -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 = {
-  NULL,  /* post_create_inferior */
   nto_attach,
   nto_kill,
   nto_detach,
index a4593cf6df91c1f58951aa17b95d7ddbe0d55cbb..81092e81ea4443e3f995d73e7286f3ceeb02c836 100644 (file)
@@ -393,3 +393,12 @@ target_terminal::info (const char *arg, int from_tty)
 {
   /* Placeholder.  */
 }
+
+/* Default implementations of target ops.
+   See target.h for definitions.  */
+
+void
+process_target::post_create_inferior ()
+{
+  /* Nop.  */
+}
index b6d04139108d599cdb2327eb97350579f4279398..87036e83846693fe4cd62a1ba9ea2078798e1176 100644 (file)
@@ -70,10 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Do additional setup after a new process is created, including
-     exec-wrapper completion.  */
-  void (*post_create_inferior) (void);
-
   /* Attach to a running process.
 
      PID is the process ID to attach to, specified by the user
@@ -489,6 +485,10 @@ public:
      process with the process list.  */
   virtual int create_inferior (const char *program,
                               const std::vector<char *> &program_args) = 0;
+
+  /* Do additional setup after a new process is created, including
+     exec-wrapper completion.  */
+  virtual void post_create_inferior ();
 };
 
 extern process_stratum_target *the_target;
@@ -499,11 +499,7 @@ void set_target_ops (process_stratum_target *);
   the_target->pt->create_inferior (program, program_args)
 
 #define target_post_create_inferior()                   \
-  do                                                    \
-    {                                                   \
-      if (the_target->post_create_inferior != NULL)     \
-       (*the_target->post_create_inferior) ();          \
-    } while (0)
+  the_target->pt->post_create_inferior ()
 
 #define myattach(pid) \
   (*the_target->attach) (pid)
index ecef54c461ebeea56d0434e9853eb8f346b7d36a..a9b1bfb2fd6bb751ae2f2356ee6db4a2b20684c0 100644 (file)
@@ -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 = {
-  NULL,  /* post_create_inferior */
   win32_attach,
   win32_kill,
   win32_detach,
This page took 0.036785 seconds and 4 git commands to generate.