Add low_new_clone method to linux_nat_target.
authorPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Mon, 30 Mar 2020 15:04:25 +0000 (12:04 -0300)
committerPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Mon, 30 Mar 2020 15:06:43 +0000 (12:06 -0300)
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
after PTRACE_EVENT_(V)FORK.

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

gdb/ChangeLog:
2020-03-30  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* linux-nat.h (low_new_clone): New method.
* linux-nat.c (linux_handle_extended_wait): Call low_new_clone.

gdb/ChangeLog
gdb/linux-nat.c
gdb/linux-nat.h

index 812d0b9b55f94467e99f82fb5cb13b82fd359bd0..61f01ab2438fd83f0426321ed743b49478a89a72 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-30  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
+
+       * linux-nat.h (low_new_clone): New method.
+       * linux-nat.c (linux_handle_extended_wait): Call low_new_clone.
+
 2020-03-29  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * dbxread.c (dbx_psymtab_to_symtab_1): Rename to...
index 133b87ca742cf00f3481673a20e8b80f41aaf746..28491859aa802666c1fa71d9a9d9b38556b911c6 100644 (file)
@@ -1978,6 +1978,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->ptid.pid ()))
index e224f89120b01e1976281e0f9322a666a2b98044..1af9e830c831c056f0492909e9fb51ce98de1285 100644 (file)
@@ -164,6 +164,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)
This page took 0.029451 seconds and 4 git commands to generate.