+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
/* 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);
static linux_process_target the_linux_target;
static process_stratum_target linux_target_ops = {
- linux_post_create_inferior,
linux_attach,
linux_kill,
linux_detach,
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)))
/* The LynxOS target_ops vector. */
static process_stratum_target lynx_target_ops = {
- NULL, /* post_create_inferior */
lynx_attach,
lynx_kill,
lynx_detach,
static nto_process_target the_nto_target;
static process_stratum_target nto_target_ops = {
- NULL, /* post_create_inferior */
nto_attach,
nto_kill,
nto_detach,
{
/* Placeholder. */
}
+
+/* Default implementations of target ops.
+ See target.h for definitions. */
+
+void
+process_target::post_create_inferior ()
+{
+ /* Nop. */
+}
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
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;
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)
static win32_process_target the_win32_target;
static process_stratum_target win32_target_ops = {
- NULL, /* post_create_inferior */
win32_attach,
win32_kill,
win32_detach,