diff options
-rw-r--r-- | gdb/aarch64-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/fbsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/fbsd-nat.h | 5 | ||||
-rw-r--r-- | gdb/inf-child.c | 7 | ||||
-rw-r--r-- | gdb/inf-child.h | 2 | ||||
-rw-r--r-- | gdb/inf-ptrace.c | 2 | ||||
-rw-r--r-- | gdb/inf-ptrace.h | 11 | ||||
-rw-r--r-- | gdb/linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/linux-nat.h | 6 | ||||
-rw-r--r-- | gdb/netbsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/netbsd-nat.h | 4 | ||||
-rw-r--r-- | gdb/obsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/obsd-nat.h | 5 | ||||
-rw-r--r-- | gdb/rs6000-aix-nat.c | 5 | ||||
-rw-r--r-- | gdb/target-delegates.c | 23 | ||||
-rw-r--r-- | gdb/target.c | 8 | ||||
-rw-r--r-- | gdb/target.h | 14 | ||||
-rw-r--r-- | gdb/x86-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/x86-linux-nat.h | 7 |
19 files changed, 44 insertions, 67 deletions
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index aa42365..0ca3863 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -694,7 +694,7 @@ ps_get_thread_area (struct ps_prochandle *ph, } -/* Implement the "post_startup_inferior" target_ops method. */ +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ void aarch64_linux_nat_target::post_startup_inferior (ptid_t ptid) diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index e90aa12..e84dafd 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1548,7 +1548,7 @@ fbsd_nat_target::remove_vfork_catchpoint (int pid) } #endif -/* Implement the "post_startup_inferior" target_ops method. */ +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ void fbsd_nat_target::post_startup_inferior (ptid_t pid) diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index 34d7e6d..863c0a4 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -76,7 +76,6 @@ public: ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override; - void post_startup_inferior (ptid_t) override; void post_attach (int) override; #ifdef USE_SIGTRAP_SIGINFO @@ -106,6 +105,10 @@ public: bool supports_disable_randomization () override; +protected: + + void post_startup_inferior (ptid_t) override; + private: /* Helper routines for use in fetch_registers and store_registers in subclasses. These routines fetch and store a single set of diff --git a/gdb/inf-child.c b/gdb/inf-child.c index b65bbf3..949f530 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -202,13 +202,6 @@ inf_child_target::maybe_unpush_target () current_inferior ()->unpush_target (this); } -void -inf_child_target::post_startup_inferior (ptid_t ptid) -{ - /* This target doesn't require a meaningful "post startup inferior" - operation by a debugger. */ -} - bool inf_child_target::can_run () { diff --git a/gdb/inf-child.h b/gdb/inf-child.h index 1e009b6..ce8feaf 100644 --- a/gdb/inf-child.h +++ b/gdb/inf-child.h @@ -55,8 +55,6 @@ public: void interrupt () override; void pass_ctrlc () override; - void post_startup_inferior (ptid_t) override; - void follow_exec (inferior *follow_inf, ptid_t ptid, const char *execd_pathname) override; diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 2e7a03c..bbf38c0 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -103,7 +103,7 @@ inf_ptrace_target::create_inferior (const char *exec_file, /* On some targets, there must be some explicit actions taken after the inferior has been started up. */ - target_post_startup_inferior (ptid); + post_startup_inferior (ptid); } /* Clean up a rotting corpse of an inferior after it died. */ diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h index 8aded9b..a4ad096 100644 --- a/gdb/inf-ptrace.h +++ b/gdb/inf-ptrace.h @@ -60,6 +60,17 @@ struct inf_ptrace_target : public inf_child_target protected: /* Cleanup the inferior after a successful ptrace detach. */ void detach_success (inferior *inf); + + /* Some targets don't allow us to request notification of inferior events + such as fork and vfork immediately after the inferior is created. + (This is because of how gdb creates inferiors via invoking a shell to + do it. In such a scenario, if the shell init file has commands in it, + the shell will fork and exec for each of those commands, and we will + see each such fork event. Very bad.) + + Such targets will supply an appropriate definition for this + function. */ + virtual void post_startup_inferior (ptid_t ptid) = 0; }; #ifndef __NetBSD__ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 9d4b05a..20aa4a1 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -411,6 +411,8 @@ linux_nat_target::post_attach (int pid) linux_init_ptrace_procfs (pid, 1); } +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ + void linux_nat_target::post_startup_inferior (ptid_t ptid) { diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 95e26b7..116eb7e 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -129,8 +129,6 @@ public: char *pid_to_exec_file (int pid) override; - void post_startup_inferior (ptid_t) override; - void post_attach (int) override; void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool) override; @@ -189,6 +187,10 @@ public: /* SIGTRAP-like breakpoint status events recognizer. The default recognizes SIGTRAP only. */ virtual bool low_status_is_event (int status); + +protected: + + void post_startup_inferior (ptid_t) override; }; /* The final/concrete instance. */ diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c index 7dfc586..1eb2c76 100644 --- a/gdb/netbsd-nat.c +++ b/gdb/netbsd-nat.c @@ -132,7 +132,7 @@ nbsd_add_threads (nbsd_nat_target *target, pid_t pid) netbsd_nat::for_each_thread (pid, fn); } -/* Implement the "post_startup_inferior" target_ops method. */ +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ void nbsd_nat_target::post_startup_inferior (ptid_t ptid) diff --git a/gdb/netbsd-nat.h b/gdb/netbsd-nat.h index 43d60eb..ad83f20 100644 --- a/gdb/netbsd-nat.h +++ b/gdb/netbsd-nat.h @@ -32,7 +32,6 @@ struct nbsd_nat_target : public inf_ptrace_target bool thread_alive (ptid_t ptid) override; const char *thread_name (struct thread_info *thr) override; - void post_startup_inferior (ptid_t ptid) override; void post_attach (int pid) override; void update_thread_list () override; std::string pid_to_str (ptid_t ptid) override; @@ -57,6 +56,9 @@ struct nbsd_nat_target : public inf_ptrace_target ULONGEST *xfered_len) override; bool supports_dumpcore () override; void dumpcore (const char *filename) override; + +protected: + void post_startup_inferior (ptid_t ptid) override; }; #endif /* netbsd-nat.h */ diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c index c70820d..2340dfe 100644 --- a/gdb/obsd-nat.c +++ b/gdb/obsd-nat.c @@ -145,6 +145,8 @@ obsd_nat_target::post_attach (int pid) obsd_enable_proc_events (pid); } +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ + void obsd_nat_target::post_startup_inferior (ptid_t pid) { diff --git a/gdb/obsd-nat.h b/gdb/obsd-nat.h index 1f74b99..5ebbf61 100644 --- a/gdb/obsd-nat.h +++ b/gdb/obsd-nat.h @@ -35,9 +35,10 @@ class obsd_nat_target : public inf_ptrace_target int remove_fork_catchpoint (int) override; - void post_startup_inferior (ptid_t) override; - void post_attach (int) override; + +protected: + void post_startup_inferior (ptid_t) override; }; #endif /* obsd-nat.h */ diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c index d74211f..682e4e9 100644 --- a/gdb/rs6000-aix-nat.c +++ b/gdb/rs6000-aix-nat.c @@ -91,6 +91,11 @@ public: ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override; +protected: + + void post_startup_inferior (ptid_t ptid) override + { /* Nothing. */ } + private: enum target_xfer_status xfer_shared_libraries (enum target_object object, diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index fb9c78a..9636e32 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -51,7 +51,6 @@ struct dummy_target : public target_ops void terminal_info (const char *arg0, int arg1) override; void kill () override; void load (const char *arg0, int arg1) override; - void post_startup_inferior (ptid_t arg0) override; int insert_fork_catchpoint (int arg0) override; int remove_fork_catchpoint (int arg0) override; int insert_vfork_catchpoint (int arg0) override; @@ -226,7 +225,6 @@ struct debug_target : public target_ops void terminal_info (const char *arg0, int arg1) override; void kill () override; void load (const char *arg0, int arg1) override; - void post_startup_inferior (ptid_t arg0) override; int insert_fork_catchpoint (int arg0) override; int remove_fork_catchpoint (int arg0) override; int insert_vfork_catchpoint (int arg0) override; @@ -1393,27 +1391,6 @@ debug_target::load (const char *arg0, int arg1) fputs_unfiltered (")\n", gdb_stdlog); } -void -target_ops::post_startup_inferior (ptid_t arg0) -{ - this->beneath ()->post_startup_inferior (arg0); -} - -void -dummy_target::post_startup_inferior (ptid_t arg0) -{ -} - -void -debug_target::post_startup_inferior (ptid_t arg0) -{ - fprintf_unfiltered (gdb_stdlog, "-> %s->post_startup_inferior (...)\n", this->beneath ()->shortname ()); - this->beneath ()->post_startup_inferior (arg0); - fprintf_unfiltered (gdb_stdlog, "<- %s->post_startup_inferior (", this->beneath ()->shortname ()); - target_debug_print_ptid_t (arg0); - fputs_unfiltered (")\n", gdb_stdlog); -} - int target_ops::insert_fork_catchpoint (int arg0) { diff --git a/gdb/target.c b/gdb/target.c index 06a21c4..65d2a1c 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -302,14 +302,6 @@ target_files_info () /* See target.h. */ -void -target_post_startup_inferior (ptid_t ptid) -{ - return current_inferior ()->top_target ()->post_startup_inferior (ptid); -} - -/* See target.h. */ - int target_insert_fork_catchpoint (int pid) { diff --git a/gdb/target.h b/gdb/target.h index e709b7d..4736d32 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -626,8 +626,6 @@ struct target_ops virtual bool can_create_inferior (); virtual void create_inferior (const char *, const std::string &, char **, int); - virtual void post_startup_inferior (ptid_t) - TARGET_DEFAULT_IGNORE (); virtual int insert_fork_catchpoint (int) TARGET_DEFAULT_RETURN (1); virtual int remove_fork_catchpoint (int) @@ -1688,18 +1686,6 @@ extern void target_kill (void); extern void target_load (const char *arg, int from_tty); -/* Some targets (such as ttrace-based HPUX) don't allow us to request - notification of inferior events such as fork and vork immediately - after the inferior is created. (This because of how gdb gets an - inferior created via invoking a shell to do it. In such a scenario, - if the shell init file has commands in it, the shell will fork and - exec for each of those commands, and we will see each such fork - event. Very bad.) - - Such targets will supply an appropriate definition for this function. */ - -extern void target_post_startup_inferior (ptid_t ptid); - /* On some targets, we can catch an inferior fork or vfork event when it occurs. These functions insert/remove an already-created catchpoint for such events. They return 0 for success, 1 if the diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index adea1ad..7176908 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -81,6 +81,8 @@ x86_linux_nat_target::~x86_linux_nat_target () { } +/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */ + void x86_linux_nat_target::post_startup_inferior (ptid_t ptid) { diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h index a8123f7..e1f232a 100644 --- a/gdb/x86-linux-nat.h +++ b/gdb/x86-linux-nat.h @@ -29,9 +29,6 @@ struct x86_linux_nat_target : public x86_nat_target<linux_nat_target> { virtual ~x86_linux_nat_target () override = 0; - /* Override the GNU/Linux inferior startup hook. */ - void post_startup_inferior (ptid_t) override; - /* Add the description reader. */ const struct target_desc *read_description () override; @@ -73,6 +70,10 @@ struct x86_linux_nat_target : public x86_nat_target<linux_nat_target> void low_delete_thread (struct arch_lwp_info *lwp) override { x86_linux_delete_thread (lwp); } + +protected: + /* Override the GNU/Linux inferior startup hook. */ + void post_startup_inferior (ptid_t) override; }; |