This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/3] Add low_new_clone method to linux_nat_target.

This patch adds a low_new_clone method to linux_nat_target, called after
a PTRACE_EVENT_CLONE is detected, similar to how low_new_fork is called

This is useful for targets that need to copy state associated with a
thread that is inherited across clones.

YYYY-MM-DD  Pedro Franco de Carvalho  <>

	* linux-nat.h (low_new_clone): New method.
	* linux-nat.c (linux_handle_extended_wait): Call low_new_clone.
 gdb/linux-nat.c | 4 ++++
 gdb/linux-nat.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 945c19f666..586d47a71d 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1976,6 +1976,10 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	     inferior.  */
 	  linux_target->low_new_fork (lp, new_pid);
+      else if (event == PTRACE_EVENT_CLONE)
+	{
+	  linux_target->low_new_clone (lp, new_pid);
+	}
       if (event == PTRACE_EVENT_FORK
 	  && linux_fork_checkpointing_p (lp-> ()))
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 0c1695ad10..04ebe9ba00 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -163,6 +163,10 @@ public:
   virtual void low_new_fork (struct lwp_info *parent, pid_t child_pid)
+  /* The method to call, if any, when a new clone event is detected.  */
+  virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp)
+  {}
   /* The method to call, if any, when a process is no longer
      attached.  */
   virtual void low_forget_process (pid_t pid)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]