Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
To: gdb-patches@sourceware.org
Cc: ulrich.weigand@de.ibm.com, rcardoso@linux.ibm.com
Subject: [PATCH v2 1/3] Add low_new_clone method to linux_nat_target.
Date: Fri, 14 Feb 2020 20:55:00 -0000	[thread overview]
Message-ID: <20200214205443.1073579-2-pedromfc@linux.ibm.com> (raw)
In-Reply-To: <20200214205443.1073579-1-pedromfc@linux.ibm.com>

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:
YYYY-MM-DD  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/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 81af83c4ac..1af7825c92 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -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 ()))
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index f800e43997..4e2c622ec4 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -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)
-- 
2.24.1


  reply	other threads:[~2020-02-14 20:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 20:55 [PATCH v2 0/3] low_new_clone in linux-nat.c and powerpc watchpoint fixes Pedro Franco de Carvalho
2020-02-14 20:55 ` Pedro Franco de Carvalho [this message]
2020-02-17 17:49   ` [PATCH v2 1/3] Add low_new_clone method to linux_nat_target Ulrich Weigand
2020-02-14 20:55 ` [PATCH v2 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat Pedro Franco de Carvalho
2020-02-17 17:47   ` Ulrich Weigand
2020-02-18 20:31     ` Pedro Franco de Carvalho
2020-02-19 13:46       ` Ulrich Weigand
2020-03-13 20:19     ` Pedro Franco de Carvalho
2020-03-27 18:50       ` Pedro Franco de Carvalho
2020-03-27 18:54         ` [PATCH] " Pedro Franco de Carvalho
2020-03-30 13:04           ` Ulrich Weigand
2020-03-30 13:03         ` [PATCH v2 3/3] " Ulrich Weigand
2020-03-30 15:13           ` Pedro Franco de Carvalho
2020-02-14 20:55 ` [PATCH v2 2/3] [PowerPC] Move up some register access routines Pedro Franco de Carvalho
2020-02-17 17:48   ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200214205443.1073579-2-pedromfc@linux.ibm.com \
    --to=pedromfc@linux.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rcardoso@linux.ibm.com \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox