public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/2] gdb: add inferior_cloned observable
Date: Wed, 13 Sep 2023 11:28:37 -0400	[thread overview]
Message-ID: <20230913152845.1540064-1-simon.marchi@efficios.com> (raw)

The following patch makes the amdgpu port transfer a property from the
original inferior to the new inferior when using the clone-inferior
command.  Add the inferior_cloned observable to help with this.

Change-Id: Id845a799813ec49b1b7b2fcb97b07d0a1e5e2631
---
 gdb/inferior.c   | 2 ++
 gdb/observable.c | 1 +
 gdb/observable.h | 4 ++++
 3 files changed, 7 insertions(+)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index ce4960a508aa..550bbd2827c0 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -1041,6 +1041,8 @@ clone_inferior_command (const char *args, int from_tty)
       for (const std::string &unset_var
 	   : orginf->environment.user_unset_env ())
 	inf->environment.unset (unset_var.c_str ());
+
+      gdb::observers::inferior_cloned.notify (orginf, inf);
     }
 }
 
diff --git a/gdb/observable.c b/gdb/observable.c
index a18b863fb471..33e51223cf41 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -58,6 +58,7 @@ DEFINE_OBSERVABLE (inferior_appeared);
 DEFINE_OBSERVABLE (inferior_pre_detach);
 DEFINE_OBSERVABLE (inferior_exit);
 DEFINE_OBSERVABLE (inferior_removed);
+DEFINE_OBSERVABLE (inferior_cloned);
 DEFINE_OBSERVABLE (memory_changed);
 DEFINE_OBSERVABLE (before_prompt);
 DEFINE_OBSERVABLE (gdb_datadir_changed);
diff --git a/gdb/observable.h b/gdb/observable.h
index c0bafc51f143..4ea203c6fc38 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -172,6 +172,10 @@ extern observable<struct inferior */* inf */> inferior_exit;
    This method is called immediately before freeing INF.  */
 extern observable<struct inferior */* inf */> inferior_removed;
 
+/* The inferior CLONE has been created by cloning INF.  */
+extern observable<struct inferior */* inf */, struct inferior */* clone */>
+    inferior_cloned;
+
 /* Bytes from DATA to DATA + LEN have been written to the inferior
    at ADDR.  */
 extern observable<struct inferior */* inferior */, CORE_ADDR /* addr */,

base-commit: 38cc67cc00dc7385991e2658a1b4213d5ba3c4f0
-- 
2.42.0


             reply	other threads:[~2023-09-13 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 15:28 Simon Marchi [this message]
2023-09-13 15:28 ` [PATCH 2/2] gdb/amdgpu: add precise-memory support Simon Marchi
2023-09-13 21:32   ` Lancelot SIX
2023-09-14 15:51     ` Simon Marchi
2023-09-14 14:10   ` Tom Tromey
2023-09-14 16:00     ` Simon Marchi
2023-09-14 16:18       ` Tom Tromey
2023-09-14 16:18         ` Simon Marchi
2023-09-14 14:08 ` [PATCH 1/2] gdb: add inferior_cloned observable Tom Tromey
2023-09-14 15:53   ` Simon Marchi

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=20230913152845.1540064-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).